Skip to content

Commit

Permalink
Query Title: Change filters for removing archive title prefixes (#49306)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Mar 24, 2023
1 parent 8da0dbf commit cacf9f6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/block-library/src/query-title/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ function render_block_core_query_title( $attributes ) {
if ( $is_archive ) {
$show_prefix = isset( $attributes['showPrefix'] ) ? $attributes['showPrefix'] : true;
if ( ! $show_prefix ) {
$filter_title = function( $title, $original_title ) {
return $original_title;
};
add_filter( 'get_the_archive_title', $filter_title, 10, 2 );
add_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
$title = get_the_archive_title();
remove_filter( 'get_the_archive_title', $filter_title, 10, 2 );
remove_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
} else {
$title = get_the_archive_title();
}
Expand Down

0 comments on commit cacf9f6

Please sign in to comment.