The admin_title WordPress PHP filter allows you to modify the title tag content for an admin page.
Usage
add_filter('admin_title', 'your_custom_function', 10, 2);
function your_custom_function($admin_title, $title) {
// Your custom code here
return $admin_title;
}
Parameters
$admin_title(string) – The page title, with extra context added.$title(string) – The original page title.
More information
See WordPress Developer Resources: admin_title
Examples
Add custom prefix to admin titles
Add a custom prefix to all admin page titles.
add_filter('admin_title', 'add_custom_prefix_to_admin_titles', 10, 2);
function add_custom_prefix_to_admin_titles($admin_title, $title) {
return '[Custom] ' . $admin_title;
}
Add site name to admin titles
Add the site name to admin page titles.
add_filter('admin_title', 'add_site_name_to_admin_titles', 10, 2);
function add_site_name_to_admin_titles($admin_title, $title) {
$site_name = get_bloginfo('name');
return $admin_title . ' | ' . $site_name;
}
Change title on specific admin page
Change the title of a specific admin page, e.g., ‘example_page’.
add_filter('admin_title', 'change_specific_admin_page_title', 10, 2);
function change_specific_admin_page_title($admin_title, $title) {
global $pagenow;
if ($pagenow === 'example_page.php') {
$admin_title = 'New Title';
}
return $admin_title;
}
Remove extra context from admin titles
Remove extra context from admin page titles and display only the original title.
add_filter('admin_title', 'remove_extra_context_from_admin_titles', 10, 2);
function remove_extra_context_from_admin_titles($admin_title, $title) {
return $title;
}
Append custom text to admin titles
Append custom text to all admin page titles.
add_filter('admin_title', 'append_custom_text_to_admin_titles', 10, 2);
function append_custom_text_to_admin_titles($admin_title, $title) {
return $admin_title . ' - Custom Text';
}