[wp-trac] [WordPress Trac] #54844: Unnecessary database queries when a block theme isn't in use
WordPress Trac
noreply at wordpress.org
Fri Feb 4 10:37:08 UTC 2022
#54844: Unnecessary database queries when a block theme isn't in use
--------------------------+------------------------------------
Reporter: johnbillion | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.9.1
Component: Query | Version: 5.8
Severity: normal | Resolution:
Keywords: has-patch | Focuses: template, performance
--------------------------+------------------------------------
Comment (by costdev):
Nicely spotted @manfcarlo. I'm not sure what's going on there either.
----
`locate_block_template()` is called in:
1.
[https://developer.wordpress.org/reference/functions/get_query_template/
get_query_template()]
2.
[https://developer.wordpress.org/reference/functions/_add_template_loader_filters/
_add_template_loader_filters()]
----
Reviewing checks:
- `get_query_template()` currently performs no checks.
- `_add_template_loader_filters()` checks if the theme supports `block-
templates`.
-
[https://developer.wordpress.org/reference/functions/the_block_template_skip_link/
the_block_template_skip_link] does a check for `block-templates` support
which is documented as checking for a block theme. This may just need a
doc change, but noting it here as it performs a check.
- Related ticket #54917 proposes to add a `block-templates` check directly
to `locate_block_template()` and has a patch.
In an effort to standardize the checks here, I think these functions
should be evaluated when no checks exist, and existing checks should be
evaluated to determine whether `current_theme_supports( 'block-templates'
)` is enough, or if `is_wp_block_theme()` should be added as well.
----
Both this ticket and #54917 aim to achieve the same thing, but #54917 is
specifically targeting one instance.
As ''this'' ticket existed first, provides the reasons for a change,
details the impact of not making a change, and its title applies to the
whole codebase rather than one instance, we can either consider this an
umbrella ticket, or move the patch from #54917 to here and close it as a
duplicate.
Thoughts?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54844#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list