[wp-trac] [WordPress Trac] #43661: Un-neccessary call to get_post() in get_body_class() method

WordPress Trac noreply at wordpress.org
Sun Aug 20 17:42:09 UTC 2023


#43661: Un-neccessary call to get_post() in get_body_class() method
-------------------------------------------------+-------------------------
 Reporter:  pat@…                                |       Owner:
                                                 |  spacedmonkey
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.4
Component:  Posts, Post Types                    |     Version:  4.9.4
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch 2nd-opinion needs-testing  |     Focuses:  multisite,
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by oglekler):

 @spacedmonkey there are also several calls for
 `$wp_query->get_queried_object()` in the same function, can we remove them
 as well? And actually it can be:

 {{{#!php
 $post      = $wp_query->get_queried_object();
 $post_id   = $post->ID;
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43661#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list