apply_filters( 'get_the_archive_title', string $title, string $original_title, string $prefix )

Filters the archive title.


Parameters Parameters

$title

(string) Archive title to be displayed.

$original_title

(string) Archive title without prefix.

$prefix

(string) Archive title prefix.


Top ↑

Source Source

File: wp-includes/general-template.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
5.5.0 Added the $prefix and $original_title parameters.
4.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content

    TIP: Using the hook to get rid of archive “label”:

    If you would like to get rid of the “Category:”, “Tag:”, “Author:”, “Archives:” and “Other taxonomy name:” in the archive title, use this little function in your (child) theme functions.php file:

    function my_theme_archive_title( $title ) {
    	if ( is_category() ) {
    		$title = single_cat_title( '', false );
    	} elseif ( is_tag() ) {
    		$title = single_tag_title( '', false );
    	} elseif ( is_author() ) {
    		$title = '<span class="vcard">' . get_the_author() . '</span>';
    	} elseif ( is_post_type_archive() ) {
    		$title = post_type_archive_title( '', false );
    	} elseif ( is_tax() ) {
    		$title = single_term_title( '', false );
    	}
     
    	return $title;
    }
    
    add_filter( 'get_the_archive_title', 'my_theme_archive_title' );
    

You must log in before being able to contribute a note or feedback.