Skip to content

Commit

Permalink
Update get_the_archive_title()
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Dec 4, 2024
1 parent e9f704c commit 66a05a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1760,14 +1760,17 @@ function get_the_archive_title() {
$prefix = _x( 'Archives:', 'post type archive title prefix' );
} elseif ( is_tax() ) {
$queried_object = get_queried_object();
if ( $queried_object ) {
if ( $queried_object instanceof WP_Term ) {
$tax = get_taxonomy( $queried_object->taxonomy );
$title = single_term_title( '', false );
$prefix = sprintf(
/* translators: %s: Taxonomy singular name. */
_x( '%s:', 'taxonomy term archive title prefix' ),
$tax->labels->singular_name
);
} elseif ( $queried_object instanceof WP_Taxonomy ) {
$title = $queried_object->labels->singular_name;
$prefix = _x( 'Archives:', 'taxonomy archive title prefix' );
}
}

Expand Down

0 comments on commit 66a05a8

Please sign in to comment.