[wp-trac] [WordPress Trac] #56923: register_block_core_template_part does WP_Query even on themes that do not support it

WordPress Trac noreply at wordpress.org
Fri Nov 4 14:22:35 UTC 2022


#56923: register_block_core_template_part does WP_Query even on themes that do not
support it
--------------------------+--------------------------
 Reporter:  spacedmonkey  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  6.1.1
Component:  Themes        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+--------------------------

Comment (by Cybr):

 This `WP_Query` is invoked before `template_redirect`, so template parts
 are requested before we even know what kind of template we're dealing
 with.

 Succinctly, I expect filters `pre_get_posts` / `the_posts` not to be
 queried before action `wp_loaded`. I think this premature registration is
 harmful, not only because it now [https://wordpress.org/support/topic
 /custom-post-types-social-graph-tags-arent-appearing-in-source-for-cpts/
 creates bugs] (CPTs aren't registered before the first query happens), but
 it causes significant performance losses.

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


More information about the wp-trac mailing list