Steps
- Add the PHP code to your theme’s
functions.php. - Save the changes.
- Go to WordPress Dashboard → Pages → All Pages.
- 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.
