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 Title: Changes filters for removing archive title prefixes #49306

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

Mamaduka
Copy link
Member

What?

Resolves #49001.

PR updates the block filters used for removing archive title prefixes.

Why?

The get_the_archive_title title only works with default priority when the showPrefix setting is true.

How?

The block now uses get_the_archive_title_prefix with __return_empty_string as a callback. When there's no prefix, the get_the_archive_title() method will return just a title.

Testing Instructions

  1. Open a Site Editor
  2. Create an archive template if there's none.
  3. Insert the "Archive Title" block, a "Query Title" block variation.
  4. Add the following filters to your codebase:
add_filter( 'get_the_archive_title', function( $title ) {
	return 'Hello ' . $title;
} );
  1. Confirm filter is applied no matter the showPrefix setting value.

Screenshots or screencast

CleanShot 2023-03-23 at 16 28 10

@Mamaduka Mamaduka requested a review from ajitbohra as a code owner March 23, 2023 12:33
@Mamaduka Mamaduka requested review from ndiego, carolinan and aristath and removed request for ajitbohra March 23, 2023 12:33
@Mamaduka Mamaduka self-assigned this Mar 23, 2023
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Block] Query Title Affects the Query Title Block labels Mar 23, 2023
@aristath aristath merged commit cacf9f6 into trunk Mar 24, 2023
@aristath aristath deleted the update/query-title-hide-prefix-filters branch March 24, 2023 06:45
@github-actions github-actions bot added this to the Gutenberg 15.5 milestone Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Title Affects the Query Title Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_the_archive_title filter at priority 10 only works when $show_prefix is false in Query Title block
2 participants