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

Hook to remove the archive title prefix breaks the "Show archive type in title" feature in core/query-title #30

Open
itsamoreh opened this issue Jul 2, 2024 · 0 comments
Labels
bug Something isn't working question Further information is requested

Comments

@itsamoreh
Copy link
Contributor

Should we remove this remove-archive-title-prefix.php hook? The core/query-title block has an option to remove the prefix which doesn't have any affect since we're always removing the prefix via a hook in the theme.

image

See https://wordpress.org/documentation/article/archive-title-block/#block-settings

The hook in wds-bt:

<?php
/**
* Removes or Adjusts the prefix on category archive page titles.
*
* @package wdsbt
*/
namespace WebDevStudios\wdsbt;
/**
* Removes or Adjusts the prefix on category archive page titles.
*
* @author WebDevStudios
*
* @param string $block_title The default $block_title of the page.
*
* @return string The updated $block_title.
*/
function remove_archive_title_prefix( $block_title ) {
// Get the single category title with no prefix.
$single_cat_title = single_term_title( '', false );
if ( is_category() || is_tag() || is_tax() ) {
return esc_html( $single_cat_title );
}
return $block_title;
}
add_filter( 'get_the_archive_title', __NAMESPACE__ . '\remove_archive_title_prefix' );

@itsamoreh itsamoreh added bug Something isn't working question Further information is requested labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant