The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Show Page ID Before the Page Title in WordPress Admin

Shared by Amit Dholiya · October 2, 2026 · @the_title

28 views
1 upvote
Back to Snippets

Steps

  1. Add the PHP code to your theme’s functions.php.
  2. Save the changes.
  3. Go to WordPress Dashboard → Pages → All Pages.
  4. The Page ID will appear before each page title.
/**
 * Show Page ID before the page title
 */
function custom_show_page_id_before_title( $title, $post_id ) {

    if ( is_admin() && get_post_type( $post_id ) === 'page' ) {
        return '[ID: ' . $post_id . '] ' . $title;
    }

    return $title;
}

add_filter( 'the_title', 'custom_show_page_id_before_title', 10, 2 );

Tested on

WordPress 6.8

Reported by the author on October 2, 2026. WPFolks has not verified this.

Not tested against WordPress 7.1.4. It may still work.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments

Proudly supported by