Can't insert images if GDE active and WP-DEBUG set to true (with solution)
-
I just spent the better part of a day tracking down a bug that was preventing me from inserting images if GDE is activated and WP_DEBUG is set to true. I eventually went to the extreme measure of copying my site and database to a testing server and deleting everything that could be deleted using the wp dashboard (posts, pages, users, categories, tags, media and every plugin other than GDE). I got down to what should be ~equivalent to a new installation, with a few reptilian options cluttering up the wp_options table. Still, I could not insert an image if GDE was active and WP_DEBUG set true.
I created a new blank database on my testing server (and tweaked wp_config) so wordpress would create virgin database (still using the file set copied from my server). GDE worked fine with WP_DEBUG. At this point the only difference between a working database and the non-working database was a few lines in the wp_options table. So I began comparing options row by row, deleting obviously abandoned orphan options as I went.
I noticed that several standard option values were not set (i.e., blank) in the failing database – in particular, the option_value for image_default_link_type was blank whereas in the virgin database the option_value for image_default_link_type was ‘file.’
Setting the option_value of image_default_link_type to ‘file’ in the failing database fixed the problem – GDE worked okay even with WP_DEBUG set to true.
The failed database was created over two years ago, with an older version of WordPress that apparently did not set default values in the options table (or else some transient plugin trashed some of the default values). I’m guessing this may be relevant to the changelog notes for version 2.5.7 (‘javascript sometimes broken with WP_DEBUG enabled’) – databases that were created on an older version of wordpress might contain blank field for options, but the GDE code is not taking that into account (at least not with the image_default_link_type option), so sometimes it fails.
I hope this helps whoever is in line to maintain the code for this wonderful plugin…
- The topic ‘Can't insert images if GDE active and WP-DEBUG set to true (with solution)’ is closed to new replies.