How to change the admin page title to something useful

Fix the HTML title of the post editor in the WordPress admin to something much more useful.
Very helpful when editing multiple posts, but also, when changing lots of images (eg. post thumbnail or product gallery etc.).


add_filter( 'admin_title', 'fix_admin_page_title' , 10, 2 );
function fix_admin_page_title( $admin_title, $title ) {
global $post, $title, $action, $current_screen;
$return = $admin_title;
if( isset( $current_screen->post_type ) && $action == 'edit' ) {
//$return = $post->post_title . ' (' . $post->ID . ') – ' . get_bloginfo('name');
$return = $post->post_title . ' (' . $post->ID . ') – ' . $admin_title;
}
return $return;
}

Leave a Reply

Your email address will not be published. Required fields are marked *