[wp-trac] [WordPress Trac] #18822: get_permalink() produces an add. DB request without $post->filter
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 30 12:58:09 UTC 2011
#18822: get_permalink() produces an add. DB request without $post->filter
-------------------------+------------------------------
Reporter: F J Kaiser | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Performance | Version: 3.2.1
Severity: major | Resolution:
Keywords: needs-patch |
-------------------------+------------------------------
Comment (by scribu):
> It seems to me that you must be doing something like direct DB queries
Not necessarily:
{{{
$posts = get_posts( array(
'cache_results' => false,
) )
}}}
Each post object will have {{{[filter] => raw}}}.
But get_post() only checks {{{empty( $post->filter )}}}:
{{{
} elseif ( is_object($post) && empty($post->filter) ) {
}}}
It should check if the filter is 'raw' before going off and doing another
query:
{{{
} elseif ( is_object($post) && ( empty($post->filter) || 'raw' ==
$post->filter ) ) {
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18822#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list