WordPress Trac: Ticket #14705: [15531] breaks is_*() conditional tagshttps://core.trac.wordpress.org/ticket/14705
<p>
<a class="closed ticket" href="https://core.trac.wordpress.org/ticket/14494" title="enhancement: Move the is_*() (aka conditional tags, conditional functions) ... (closed: fixed)">#14494</a> suggested moving the is_*() conditional tags into the WP_Query class and <a class="changeset" href="https://core.trac.wordpress.org/changeset/15531" title="is_* WP_Query methods. Props mdawaffe. fixes #14494">[15531]</a> changed <a class="missing source">trunk/wp-includes/query.php</a> to redirect those calls to the global <tt>$wp_query</tt> object.
</p>
<p>
However, it appears that this move has broken at least one of the conditional tags because <tt>$wp_query</tt> isn't known -- this is the error:
</p>
<pre class="wiki">Fatal error: Call to a member function is_feed() on a non-object in /home/frederickd/frederickding.com/wordpress/wp-includes/query.php on line 270
</pre><p>
<a class="source" href="https://core.trac.wordpress.org/browser/trunk/wp-includes/query.php?rev=15531#L270">See line 270.</a><a class="trac-rawlink" href="https://core.trac.wordpress.org/export/15531/trunk/wp-includes/query.php#L270" title="Download">​</a>
</p>
<p>
Right now I am experiencing this critical error on the homepage of a site running trunk.
</p>
en-usWordPress Trachttps://core.trac.wordpress.org/chrome/site/your_project_logo.pnghttps://core.trac.wordpress.org/ticket/14705
Trac 1.0.1freddywareThu, 26 Aug 2010 16:16:48 GMTattachment sethttps://core.trac.wordpress.org/ticket/14705
https://core.trac.wordpress.org/ticket/14705
<ul>
<li><strong>attachment</strong>
set to <em>is_feed_broken-20100826.png</em>
</li>
</ul>
<p>
is_feed() creates a critical error that stops execution.
</p>
TicketryanThu, 26 Aug 2010 16:22:11 GMThttps://core.trac.wordpress.org/ticket/14705#comment:1
https://core.trac.wordpress.org/ticket/14705#comment:1
<p>
Is the theme calling is_feed() before $wp_query is created?
</p>
TicketryanThu, 26 Aug 2010 16:23:56 GMTmilestone changedhttps://core.trac.wordpress.org/ticket/14705#comment:2
https://core.trac.wordpress.org/ticket/14705#comment:2
<ul>
<li><strong>milestone</strong>
changed from <em>Awaiting Review</em> to <em>3.1</em>
</li>
</ul>
TicketfreddywareThu, 26 Aug 2010 16:50:58 GMTkeywords deletedhttps://core.trac.wordpress.org/ticket/14705#comment:3
https://core.trac.wordpress.org/ticket/14705#comment:3
<ul>
<li><strong>keywords</strong>
<em>needs-patch</em> removed
</li>
</ul>
<p>
Aha. I did a <tt>debug_backtrace()</tt> and found that the violating line was in the W3 Total Cache plugin, which calls <tt>is_feed()</tt> on line 807 of <tt>w3-total-cache/lib/W3/Plugin/Minify.php</tt>.
</p>
<p>
While I recognize that this is now a bug in a plugin and not core, it seems problematic that this core commit breaks W3 Total Cache. I guess I now have to ... disable the caching plugin.
</p>
<p>
Is there any way that this move can be made more backward-compatible?
</p>
TicketscribuThu, 26 Aug 2010 17:23:58 GMTstatus changed; resolution set; milestone deletedhttps://core.trac.wordpress.org/ticket/14705#comment:4
https://core.trac.wordpress.org/ticket/14705#comment:4
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
<li><strong>milestone</strong>
<em>3.1</em> deleted
</li>
</ul>
<p>
This change only makes the error in W3 Total Cache more apparent. Previously, it would have triggered a notice, which normally isn't displayed.
</p>
<p>
So this is actually a good oportunity for the plugin author to fix the code.
</p>
TicketnacinMon, 30 Aug 2010 08:04:02 GMThttps://core.trac.wordpress.org/ticket/14705#comment:5
https://core.trac.wordpress.org/ticket/14705#comment:5
<p>
Going to manage the side effects of <a class="changeset" href="https://core.trac.wordpress.org/changeset/15531" title="is_* WP_Query methods. Props mdawaffe. fixes #14494">[15531]</a> in <a class="closed ticket" href="https://core.trac.wordpress.org/ticket/14729" title="defect (bug): Fatal errors after [15531] when conditional tags are used too early (closed: fixed)">#14729</a>.
</p>
Ticket