apply_filters( ‘admin_title’, string $admin_title, string $title )

Filters the title tag content for an admin page.

Parameters

$admin_titlestring
The page title, with extra context added.
$titlestring
The original page title.

Source

$admin_title = apply_filters( 'admin_title', $admin_title, $title );

Changelog

VersionDescription
3.1.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    How to customize the WordPress admin title using the apply_filters hook with multiple conditions. The admin_title filter allows you to modify the title displayed in the admin area based on different criteria.

    function wpdocs_admin_title_filter( $admin_title, $title ) {
        // Example condition: Modify title if user is on the dashboard
        if ( is_admin() && 'Dashboard' === $title ) {
            $admin_title = __( 'welcome to Dashboard' );
        }
    
        // Example condition: Modify title for specific post type edit page
        if ( is_admin() && isset( $_GET['post_type'] ) && 'product' === $_GET['post_type'] ) {
            $admin_title = __( 'Editing Products' ) . ' - ' . $title;
        }
    
        // Example condition: Modify title based on user role
        if ( is_admin() && current_user_can( 'administrator' ) ) {
            $admin_title = __( 'Admin:' ) . ' ' . $title;
        }
    
        return $admin_title;
    }
    
    add_filter( 'admin_title', 'wpdocs_admin_title_filter', 10, 2 );

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