Problem: Clicking the “Add Photo” link opens up a New Page

Clicking the “Add Photo” link opens up a New Page, usually a 404 error.  What gives?

This symptom can have a couple of different sources.

  1. Most frequently, this is a template problem.  There are two template tags (PHP code that is specific to WordPress and used in Themes to make stuff happen) that should be called in all WordPress Themes…well, at least all the ones that intend to use plugins or do anything cool:
    1. wp_head() – should be called in the header.php file,
    2. wp_footer() – should be called in footer.php

    Some of the commercial frameworks may have abstracted these calls away into their own hooks. But if you’re using a theme by one of these guys, this is probably not your problem.

  2. If #1 is not the problem, then there might be a plugin that is causing a problem in either
    1. The PHP script on the server – you’ll probably see a PHP error somewhere
    2. The Javascript on the client – if you run FireFox, get FireBug and it can help you spot JavaScript errors

    Try deactivating your plugins to see if you can isolate the offending plugin.  If there are lots of activated plugins, I usually try deactivating big chunks of them instead of 1-by-1.  Figure out which big chunk the problem is in and narrow down from there.

    After you find the offending plugin, the fun begins…you can try to fix it yourself, or try to get the plugin developer to fix it for you.

    Free tip: If you’re running a bunch of plugins ( 10 or more ), you might want to consider if you really need all of them…maybe not. Plugins usually require extra processing time, so in general, the fewer the faster (notable exceptions exist). All the same, don’t be afraid of using plugins, just be selective.  They are the one of the greatest features of WordPress.

  3. Another problem might be clicking the Add Photo button before the page is completely loaded.  The Thickbox initialization occurs late in the page load, so you have to wait for it…I’m going to hide the Add Photo button until it’s ready in a future version of PhotoSmash.
  4. Another issue on the user’s end might be that their browser might be blocking Javascript (or have it turned off).  The upload is AJAX and requires Javascript be on, even if you’re always displaying the upload form (forgoing the Thickbox).

If you come up with some other causes and solutions, please post below and I’ll add to the list!

Tags: , ,