Description
When you change the default post type archive title, you can see it works when on a post type archive page, but there's no effect on the content displayed by the breadcrump for a single post.
Without changing the post type archive title :
- archive page : Home > Events archive
- single page : Home > Events archive > Term name > Post title
When using the post_type_archive_title hook to rename the post type archive title :
- archive page : Home > Events
- single page : Home > Events archive > Term name > Post title
I have used the following function to rename the post type archive title
function rename_archive_title( string $title ): string {
$post_type = get_query_var( 'post_type' );
$post_type_object = get_post_type_object( $post_type );
return $post_type_object->labels->name ?? $title;
}
add_filter( 'post_type_archive_title', __NAMESPACE__ . '\rename_archive_title', 10 );
Step-by-step reproduction instructions
- Change the post type archive title using the
post_type_archive_title filter hook
- See that it works on the breadcrumb displayed on the archive page
- See that it has no effect on the breadcrumb displayed on the single page
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
Description
When you change the default post type archive title, you can see it works when on a post type archive page, but there's no effect on the content displayed by the breadcrump for a single post.
Without changing the post type archive title :
When using the
post_type_archive_titlehook to rename the post type archive title :I have used the following function to rename the post type archive title
Step-by-step reproduction instructions
post_type_archive_titlefilter hookScreenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.