Skip to content

Instantly share code, notes, and snippets.

@ginsterbusch
Last active August 15, 2022 13:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ginsterbusch/3c18f6863c070a2e35148ef8f1e66911 to your computer and use it in GitHub Desktop.
Fix annoying meaningless page titles in the WordPress post editor. Very helpful if you have to edit multiple posts at once and dont want to lose track.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment