[wp-trac] Re: [WordPress Trac] #5185: SQL Error on feeds for
invalid posts
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 6 13:35:50 GMT 2007
#5185: SQL Error on feeds for invalid posts
-----------------------------------------+----------------------------------
Reporter: robertaccettura | Owner: pishmishy
Type: defect | Status: assigned
Priority: normal | Milestone: 2.4
Component: General | Version: 2.3
Severity: major | Resolution:
Keywords: sql, error, feed, query.php |
-----------------------------------------+----------------------------------
Comment (by pishmishy):
I think this needs to be done slightly differently, although it's possible
I've gone in the wrong direction as I'm not too familiar with query.php.
I've added
{{{
if ($this->is_comment_feed && !$this->have_posts) {
//Escape if the post doesn't exist
$this->set_404();
return array();
}
if ( $this->is_comment_feed && ( $this->is_archive || ...
}}}
just before the invalid SQL is formed (line 1200, query.php). This causes
a 404 error to be raised and an empty result returned. The feed templating
doesn't appear to allow for them to raise a 404, so something along the
lines of
{{{
if(is_404()){
status_header( 404 );
include(get_404_template());
return;
}
}}}
needs to be added to the start of each template. Perhaps there's a tidier
way to handle 404 errors for every feed template together?
--
Ticket URL: <http://trac.wordpress.org/ticket/5185#comment:10>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list