apply_filters( 'pre_get_document_title', string $title )

Filters the document title before it is generated.


Description Description

Passing a non-empty value will short-circuit wp_get_document_title(), returning that value instead.


Top ↑

Parameters Parameters

$title

(string) The document title. Default empty string.


Top ↑

Source Source

File: wp-includes/general-template.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 2 content
    Contributed by Shibbir Ahmed

    If you want to change the archive page title of your custom post type then use this code:

    function change_custom_post_type_archive_title( $title ) {
        if ( is_post_type_archive( 'your-custom-post-type' ) ){
            $title = 'My Custom post type archive - ' . get_bloginfo('name');
            return $title;
        }
        return $title;
    }
    
    add_filter( 'pre_get_document_title', 'change_custom_post_type_archive_title', 9999 );

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