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

Display Post ID in WordPress Admin Posts and Pages List

Shared by Abdullah Kaludi · October 12, 2026 · @manage_posts_columns, manage_pages_columns, manage_posts_custom_column, manage_pages_custom_column

1 copy
57 views
Back to Snippets

Quickly identify WordPress post and page IDs by adding a Post ID column to the admin lists. Useful for developers working with custom queries, Elementor templates, shortcodes, and plugin configurations. A lightweight PHP snippet with no additional plugin required.

Steps

  1. Add the PHP code to your child theme’s functions.php file or use the Code Snippets plugin.
  2. Save and activate the snippet.
  3. Go to WordPress Admin → Posts → All Posts or Pages → All Pages.
  4. You’ll see a new Post ID column displaying the ID of each post or page.

Hooks Used

Type: WordPress Admin Customization

Output: A new Post ID column appears in the WordPress admin Posts and Pages lists, allowing you to identify content IDs at a glance.

Why use this snippet? It saves time when working with custom queries, Elementor templates, shortcodes, and plugin settings that require post or page IDs. You can find the ID without opening each item individually.


/**
 * Display post IDs in the WordPress admin Posts and Pages lists.
 */

function wpfolks_add_post_id_column( $columns ) {
    $columns['wpfolks_post_id'] = 'Post ID';

    return $columns;
}

add_filter( 'manage_posts_columns', 'wpfolks_add_post_id_column' );
add_filter( 'manage_pages_columns', 'wpfolks_add_post_id_column' );

/**
 * Display the post ID in the admin columns.
 */
function wpfolks_display_post_id_column( $column, $post_id ) {
    if ( 'wpfolks_post_id' === $column ) {
        echo esc_html( (string) $post_id );
    }
}

add_action(
    'manage_posts_custom_column',
    'wpfolks_display_post_id_column',
    10,
    2
);

add_action(
    'manage_pages_custom_column',
    'wpfolks_display_post_id_column',
    10,
    2
);

Tested on

WordPress 7.1.2 PHP 8.3

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

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