[wp-trac] [WordPress Trac] #57736: Remove unused parameter in query for `get_block_templates` method

WordPress Trac noreply at wordpress.org
Thu Feb 16 16:57:37 UTC 2023


#57736: Remove unused parameter in query for `get_block_templates` method
-------------------------+-----------------------------
 Reporter:  oandregal    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Themes       |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:  template     |
-------------------------+-----------------------------
 I've run into a piece of code that calls the [https://github.com/WordPress
 /wordpress-develop/blob/dcec7f5554963149f29b462ee5c049024c38d62f/src/wp-
 includes/block-template-utils.php#L876 get_block_templates function].

 This is it:

 {{{#!php
 <?php
 $query     = array(
     'theme'    => get_stylesheet(),
     'slug__in' => $slugs,
 );
 $templates = get_block_templates( $query );
 }}}

 While querying by the active theme looks sensible, that's not how
 `get_block_templates` implementation works: the `theme` parameter is not
 used anywhere, so it can be safely removed to avoid inducing the reader it
 is an allowed filter to `get_block_templates`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57736>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list