Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query by name. #43850

Merged
merged 1 commit into from
Sep 8, 2022
Merged

Conversation

spacedmonkey
Copy link
Member

What?

Use a query by name, for consistency, as other parts of code use name instead of slug. Save a database query.

Before

Screenshot 2022-09-05 at 11 33 06

After

Screenshot 2022-09-05 at 11 32 51

Why?

'tax_query' => array(
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => wp_get_theme()->get_stylesheet(),
),
),

'tax_query' => array(
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => $theme,
),
),

'tax_query' => array(
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => wp_get_theme()->get_stylesheet(),
),
),

How?

Testing Instructions

Screenshots or screencast

@spacedmonkey spacedmonkey added Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core labels Sep 5, 2022
@spacedmonkey spacedmonkey self-assigned this Sep 5, 2022
@spacedmonkey spacedmonkey added the [Type] Performance Related to performance efforts label Sep 7, 2022
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me.

  • Both name and slug are indexed so which field to be consistent with makes no difference
  • term uses an identical value, wp_get_theme()->get_stylesheet() for both name and slug so it doesn't appear that targetting one or the other is more technically correct.

@spacedmonkey spacedmonkey merged commit 52bcad9 into WordPress:trunk Sep 8, 2022
@github-actions github-actions bot added this to the Gutenberg 14.1 milestone Sep 8, 2022
@Mamaduka Mamaduka removed the Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants