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

Add Page ID as a Column in the WordPress Pages List

Shared by Amit Dholiya · October 2, 2026

8 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. A new Page ID column will appear.
  5. Each page will show its unique ID.
/**
 * Add Page ID column to WordPress Pages list
 */
function custom_add_page_id_column( $columns ) {

    $columns['page_id'] = 'Page ID';

    return $columns;
}

add_filter( 'manage_pages_columns', 'custom_add_page_id_column' );


/**
 * Display Page ID in the custom column
 */
function custom_display_page_id_column( $column, $post_id ) {

    if ( 'page_id' === $column ) {
        echo esc_html( $post_id );
    }
}

add_action(
    'manage_pages_custom_column',
    'custom_display_page_id_column',
    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.3. 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