Locating a post’s post ID
Often you will find functionality for your site that needs a post ID specified. This may be something provided by your current theme, or a plugin you have installed to manage certain tasks. The issue is that not all of them provide easy ways to look up the associated ID, and leave that up to the user. In this brief tutorial, we hope to help you easily find the needed post ID.
Whenever you are in the post editor for a started post, the ID is present within the URL. The URL will look something like the image below, and be structured like /wp-admin/post.php?post=2&action=edit. The number after the “post=” is the ID of the post you’re editing.
Do note that this value won’t be present when you first click “Add new” as the post has not been recorded into the database quite yet and assigned an ID. Saving as a draft or hitting publish will save the post to the appropriate database and refresh the page for you, providing the newly created ID in the URL.
Custom Post Type UI Extended way
While this way will not apply to ALL custom post types in your WordPress install, it will apply to all post types created with Custom Post Type UI with Custom Post Type UI Extended active.
When viewing the posts list for your CPTUI-based post types, you will see two extra columns. The first one is the ID for each post, and this will correspond to the ID you’d see with the method above. The second column is just a small thumbnail of that post’s featured image, if one is set.
The “Regular Way” applies no matter what plugins you have installed.
Regardless of the method you use to retrieve a given post’s ID, both methods highlighted above should help you out with working with your Custom Post Type UI content.