[wp-trac] [WordPress Trac] #43661: Un-neccessary call to get_post() in get_body_class() method
WordPress Trac
noreply at wordpress.org
Thu Mar 29 20:11:02 UTC 2018
#43661: Un-neccessary call to get_post() in get_body_class() method
-------------------------------------------------+-------------------------
Reporter: pat@… | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: Posts, Post Types | Review
Severity: normal | Version: 4.9.4
Keywords: has-patch 2nd-opinion needs-testing | Resolution:
| Focuses: multisite,
| performance
-------------------------------------------------+-------------------------
Changes (by mattkeys):
* keywords: => has-patch 2nd-opinion needs-testing
Comment:
I do not see any reason that get_post() needs to be called here. Comparing
what is returned from $wp_query->get_queried_object() and from get_post()
they are the same. I think this should be safe to be removed, I've
attached a diff.
In your particular use case you *may* run into a similar issue with the
call to get_pages() that happens shortly after the code you mentioned,
where you may not get the 'page-parent' class applied when it should. But
that may or may not be an issue in your implementation.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43661#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list