[wp-trac] [WordPress Trac] #11092: get_body_class() needless messes with global variables
WordPress Trac
wp-trac at lists.automattic.com
Sat Nov 14 13:38:53 UTC 2009
#11092: get_body_class() needless messes with global variables
--------------------------+-------------------------------------------------
Reporter: filosofo | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.9
Component: Template | Version: 2.9
Severity: normal | Keywords: get_body_class has-patch tested
--------------------------+-------------------------------------------------
Comment(by filosofo):
Can you substantiate your suspicions? Here's the actual database query
for a page using my patch:
{{{
SELECT * FROM wp_posts WHERE (post_type = 'page' AND post_status =
'publish') AND post_parent = 37 ORDER BY post_title ASC LIMIT 0,1
}}}
and here it is without the patch (current behavior):
{{{
SELECT ID FROM wp_posts WHERE post_parent = 37 AND post_type = 'page'
LIMIT 1
}}}
Both claim to take 0.00 seconds with the query cache off.
[[br]]
> it's probably faster than any api call we can think of
How about an API call that doesn't even have to connect to the database at
all? That's a possibility which the object cache.
> get_var() call could arguably be improved (to exclude drafts, etc.),
We shouldn't be trying to figure out this logic in multiple places (DRY).
It's almost guaranteed to produce vexing bugs in the future, for page
statuses that we forget about.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11092#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list