[wp-testers] Change in $wp_query bootstrapping?

Dougal Campbell dougal at gunters.org
Mon Nov 29 20:41:30 UTC 2010


I upgraded one of my sites from 3.0.1 to 3.1b today, and immediately ran 
into fatal errors caused by plugins.

Apparently, some of the plugins I have installed (even one of my own) 
were using conditional checks for is_page() and is_feed() in the raw, 
i.e., not from an API hook. Wrapping these calls in a function, and 
calling them from the 'init' action hook fixed things up.

Technically, I'm pretty sure that calling those conditionals before init 
wasn't working before, anyways (so I was surprised that I still had a 
plugin that was guilty of it). But it seems that some of the WP 
bootstrapping changed in such a way that the $wp_query variable is being 
initialized at a later point, which changed this 'soft' error in a fatal 
PHP error.

I don't know if we want to change anything in core's behavior regarding 
this before release, but if not, we should probably get the word out for 
plugin authors to double-check their code ASAP. I'm sure there are 
plenty of other plugins out there that do this, either accidentally, or 
because the developer didn't realize that lots of $wp_query behavior 
isn't ready to use at plugin-load time.

And for anyone curious, the plugins on my site causing the problems were 
my own 'Text Filter Suite' and the popular 'WP Ajax Edit Comments'

-- 
Dougal Campbell <dougal at gunters.org>
http://dougal.gunters.org/
http://twitter.com/dougal
http://twitual.com/



More information about the wp-testers mailing list