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
Embed
What would you like to do?
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