How I fixed my WP image/media uploader and general wp-admin problems in 2.5.1 +

After reading through a bunch of posts all over the internet, trying out every solution that worked for others, and still not getting results on my blog — it was time to roll up my sleeves.

A quick view-source on the wp-admin’s post page revealed this shiny gem:

autosaveL10n = {
    autosaveInterval: "AUTOSAVE_INTERVAL",
    ...
}

Well, hello there Mr. Classic Example Of An Undefined Constant!

A few quick greps against the current trunk showed that the constant AUTOSAVE_INTERVAL should be defined in wp-config.php (if you wish to override the default 60 second interval), or that it gets set to the default in wp-settings.php if it hasn’t been defined beforehand.

Opened up my curent wp-settings.php, ctrl+f, type in “autosave” — no match. It turns out that somewhere in the update process from 2.3.x to 2.5, stuff got mixed up: my (thought to be) latest wp-settings.php file was actually not the one from the 2.5.1 release, but, somehow, a different one (and not the one from 2.3.x either).

I have no idea how it happened, or the time right now to backtrack and figure it out. I did notice a weird thing on wordpress svn. The 2.5-tagged wp-settings.php is different from the 2.5-branch wp-settings.php — they could be using tags for different things though.

Aaaaaanywhooo, what I did to fix the issue: grabbed the latest 2.5.1 from wordpress.org and replaced my current wp-settings.php with the one from the newly downloaded ZIP file. Woot! It’s all good now: uploads working, no more autosave ajax requests happening every possible millisecond etc.

The second issue was the image/media uploader not working and just displaying “HTTP Error”. The culprit was mod_security, which i quickly got disposed of via some .htaccess directives inside the wp-admin directory:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

The above is only a quickfix to see if it is really mod_security or something else — once you’re sure it’s modsec, narrow down the directives to deal only with certain filenames, so you don’t expose your entire wp-admin directory to possible future exploits etc.

6 Responses to “How I fixed my WP image/media uploader and general wp-admin problems in 2.5.1”

  1. […] To avoid an extra plugin to fix the problem, I am going to try the methods mentioned here: … what I did to fix the issue: grabbed the latest 2.5.1 from wordpress.org and replaced my […]

  2. Just want to confirm: where do you put the modified .htaccess file? wp-admin or the root directory of WP?

  3. wp-admin

  4. Thank you for your tips.

    Yes, I did forbid directory listing using .htaccess

    Options All -Indexes

    Maybe I shall just secure wp-content directory (put .htaccess intto it) and delete the one under the root folder of WP?

  5. Yeah, try that. If it still doesn’t work, try removing the .htaccess file entirely, and just place an empty index.html or index.php file inside the wp-content folder.
    That should prevent directory listing from occurring, as the web server will probably send the empty index file.

  6. […] worked. Fortunately, I persisted, and found this little gem. If you don’t feel like reading through that post and want the nitty-gritty of how to fix the […]