How to Display Post IDs in WordPress Admin Post List

tdrayson

If you’re a WordPress developer or site administrator, you’ve probably found yourself needing to quickly reference post IDs whilst working in the admin area. By default, WordPress doesn’t display post IDs in the posts list, which means you have to edit each post or check the URL to find the ID.

Screenshot of a WordPress admin Pages screen showing a list of pages; an arrow labeled "Post ID" points to the ID number 3 beneath the "Privacy Policy" page title.

WooCommerce does this brilliantly in their product list table, where product IDs are displayed alongside the standard row actions. This inspired me to create a similar solution for regular WordPress posts, pages, and custom post types.

This tutorial shows you how to add post IDs directly to the row actions in your WordPress admin posts list, making them instantly visible and easily accessible.

The Solution

We’ll add a simple function that displays the post ID alongside the existing row actions (Edit, Quick Edit, Trash, etc.) in the posts list table.

The post ID will appear as ID: 123 at the beginning of the row actions, making it immediately visible without cluttering the interface.

Implementation

Add the code below to your theme’s functions.php file or using a code snippets plugin.

Members content only

Become a snippetclub.com member to gain instant access to this tutorial plus tons more premium content.

Already a member? Log in below.

Login Form

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise