diff --git a/packages/block-library/src/query-title/index.php b/packages/block-library/src/query-title/index.php index d781de3826b1dc..29793e5227a79f 100644 --- a/packages/block-library/src/query-title/index.php +++ b/packages/block-library/src/query-title/index.php @@ -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(); }