Skip to content

Instantly share code, notes, and snippets.

@ginsterbusch
Last active August 15, 2022 13:35
Show Gist options
  • Save ginsterbusch/3c18f6863c070a2e35148ef8f1e66911 to your computer and use it in GitHub Desktop.
Save ginsterbusch/3c18f6863c070a2e35148ef8f1e66911 to your computer and use it in GitHub Desktop.

Revisions

  1. ginsterbusch revised this gist Aug 15, 2022. No changes.
  2. ginsterbusch revised this gist Aug 15, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fix-admin-page-title.php
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ function fix_admin_page_title( $admin_title, $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 = $post->post_title . ' (' . $post->ID . ') - ' . $admin_title;
    }

    return $return;
  3. ginsterbusch revised this gist Aug 15, 2022. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions fix-admin-page-title.php
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@

    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' ) {
    /* this is the new page title */
    $title = $post->post_title . ' (' . $post->ID . ') - ' . get_bloginfo('name');
    } else {
    $title = $title . ' - ' . get_bloginfo('name');
    //$return = $post->post_title . ' (' . $post->ID . ') - ' . get_bloginfo('name');

    $return = $post->post_title . ' (' . $post->ID . ') - ' . $admin_title . '';
    }

    return $title;
    return $return;
    }
  4. ginsterbusch revised this gist Aug 15, 2022. No changes.
  5. ginsterbusch created this gist Aug 15, 2022.
    14 changes: 14 additions & 0 deletions fix-admin-page-title.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    add_filter( 'admin_title', 'fix_admin_page_title' , 10, 2 );

    function fix_admin_page_title( $admin_title, $title ) {
    global $post, $title, $action, $current_screen;

    if( isset( $current_screen->post_type ) && $action == 'edit' ) {
    /* this is the new page title */
    $title = $post->post_title . ' (' . $post->ID . ') - ' . get_bloginfo('name');
    } else {
    $title = $title . ' - ' . get_bloginfo('name');
    }

    return $title;
    }