Menu
Disclosure: ULTIDA's content is free & reader-supported. We may earn a commission if you click & buy through our links. Your support helps us create the best content & make a difference.
Tutorials

How To Find WordPress Post ID & Page ID (Easy!)

how to find wordpress post id page id

Are you wondering how to find WordPress post ID and page ID?

There are several cases where a WordPress plugin or theme will ask for an ID of your post or page.

ID number is used when a plugin has options only to make changes or add functionality to a certain post or page.

This post covers:

While, in general, the post ID is not hard to find, it’s still not as obvious as it should be.

Thus, many users scratch their heads (for quite a while) before they find it.

But, all jokes aside, let’s see what a WordPress post ID actually is.

What Are WordPress Page & Post IDs?

Post and Page IDs are UNIQUE identifiers in the form of numbers that point to a specific post or page.

That means that every piece of content on your website can be accessed via that number.

And that is also true for products, categories, tags, etc., not just posts and pages.

Even comments!

Yup, everything has a unique number. (Like we do.)

Why Do You Need Page, Category, Tag, Comment & User IDs?

The most common use is in WordPress plugins.

For example, let’s say you want to highlight specific posts in your website’s sidebar.

By default, there are widgets like Popular Posts or Recent posts, but they are dynamic and the posts in the widgets will change constantly.

And while these are great features, you sometimes only want to display a few specific featured posts.

It’s like you’d be pinning a specific post in your blog feed or even your Instagram profile.

And that’s when a post or page ID comes in handy.

You can use them to display ONLY the selected (highlighted) content.

Find Your WordPress Page ID & Post ID Without A Plugin

Let’s first take a look at how you can find both post and page ID without using a WordPress plugin.

How to find the post ID

When you are adding or editing a post, the ID number will be visible in the URL of your browser.

Not the WordPress permalink below the title, but the actual URL of the post you are editing.

how to check post id number without a plugin

The highlighted number from the example above is the post’s ID number.

That was simple enough, right?

How to find the page ID

Like the example above, head to your pages and edit the page from which you would like to extract the ID number.

how to check page id number without a plugin

As you can see, the ID number is once again part of the URL.

Simply copy and paste it into the plugin that requires it.

Bonus: How to find category, tag & comment IDs

Finding ID numbers for categories, tags and comments work similarly.

Only the semantics are slightly different.

To find an ID for a certain category, head to Posts > Categories and edit that particular category.

how to check category id number without a plugin

In this case, the number is hidden in the tag_ID identifier.

Follow exactly the same procedure to find the tag ID (head to Posts > Tags and edit that particular tag).

And finally, let’s extract the ID number of a specific comment.

Yes, even comments have unique identifiers, even if you have 1,000s of them.

Head straight to Comments > All Comments and edit that specific comment that you are interested in.

how to find comment id number without a plugin

As you can see from the image above, this time, the number is behind the letter C.

So, the steps to find the unique ID of each piece of content are very similar in all examples.

Just don’t be misguided by different identifiers that are used. In the end, the ID is always a number.

Note: I don’t recommend using a plugin to identify ID numbers because it’s quick to find them manually.

But still:

Find Your WordPress Page ID & Post ID With A Plugin

If you prefer using a plugin to find your content’s ID, first install and activate a WordPress plugin.

I recommend using Reveal IDs WordPress plugin from the WP repository.

how to find id with reveal wordpress plugin

After the activation, head to posts (or pages, comments, categories, etc.).

You will notice an extra column at the end named ID that represents the ID number of that particular piece of content.

And there you go. It’s as simple as that.

You can now see the ID number of each post from the main posts or pages interface.

There is no need to edit each post individually to see it and that can save you a lot of time.

Find Your WordPress Page ID & Post ID With Custom Code

If you are tech-savvy and comfortable with editing the functions.php file you can also add some custom PHP code to display the ID numbers in the same manner as the Reveal IDs plugin.

Attention: I don’t advise dealing with the code if you don’t know exactly what you’re doing.

You will need to use an FTP client like Filezilla to modify the file.

Follow these steps to edit the functions.php file:

  1. Connect to your host through the FTP client. You need your FTP username and password for that. (Contact your hosting if you don’t have login credentials.)
  2. Navigate to the /wp-content/themes/ folder once connected.
  3. Find your theme’s folder (make sure you are using a child theme because it allows you to update WordPress theme without losing previous customizations).
  4. Locate and download the functions.php file within your theme’s folder.
  5. Edit the file with a text editor (I recommend Notepad++).

Here’s the code you need to add to this file:

/*
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);
*/

This code snippet will add an extra column at the end that displays the ID number of the post.

Without a plugin like in the above case.

Conclusion On How To Find Page & Post IDs

New users can be confused with the term post/page ID as it’s not very obvious what exactly it represents in WordPress.

And when they install a plugin that requires the ID number to work properly, some admins cannot locate it.

And that’s where my tutorial comes in handy.

Remember, you will find that ID number in no time.

No Comments

    Leave a Reply