Webstick.blog logo Wordpress, Design, SEO, Speed blog

Get Post ID WordPress [2024] 💥

Get Post ID WordPress

How to find post ID in Wordpress? WordPress internally recognizes certain pages and posts by their ID number. This information may be required if you use a plugin asking you to select which posts you wish to exclude or include from its effects. In some cases, WordPress post IDs may also be required for custom shortcodes. All right, let's start getting a few post IDs!


Divi Ad 680px

1. Hover over the post title and get ID

To get the post ID in Wordpress you just have to click on "Posts" in your back-end. Then you hover over a post tile and below in your screen a URL is shown with the post ID. It is that simple. See screenshot below.

Get Post ID WordPress hover over the post title

2. Open the post and get ID

A bit more work but also very easy is to open a Wordpress post and the url including post-ID will also be at the bottom of your screen. See screenshot.

Open the Wordpress post and get post-ID

3. Adding a column with the post-ID's

By far the nicest solution is to create an extra column that displays the post IDs where all posts are listed. This code below can be added to the functions.php folder of your active WordPress theme. If you don't want it to be deleted with a theme upgrade later, use a child theme.

function add_column( $columns ){
	$columns['post_id_clmn'] = 'ID'; // $columns['Column ID'] = 'Column Title';
	return $columns;
add_filter('manage_posts_columns', 'add_column', 5);

function column_content( $column, $id ){
	if( $column === 'post_id_clmn')
		echo $id;
add_action('manage_posts_custom_column', 'column_content', 5, 2);

The result will look like what you see below in the screenshot.

Add column showing post IDs

4. Getting post-ID from WP-database

Just open your Cpanel or other Hosting-panel and go to phpMyAdmin. See screenshot below.

Getting post-ID from WP-database

Click on the database name that your website uses. Next, click on the table named wp-posts. As can be seen on the screenshot below, the post ID's are showing in the column.

ID wp-posts

5. Getting post-ID using a plugin

A plugin does just that what we have talked about in chapter 3, it creates a column where your posts are listed with the post IDs. A plugin makes your site a little bit slower but you don't have to mess around with codes and does not requier the use of a child theme. I would certainly prefer this method. My preferred plugin to find the post ID is Show IDs by DraftPress. The plugin does not have any settings, just install, activate, and you are good to go.

Show IDs by DraftPress

There are many more ways to get a post ID in Wordpress, but these are all involving functions and coding and are definitely not recommended. By the way, the tutorial for "get PAGE-ID" is here.


Divi Ad 680px

Scroll up