How to find page ID in WordPress?

Pages in WP are identified not only by their name, and URL but also by their ID. WP generates and assigns an ID to each post/page you create. This ID is saved in the post database table along with the published/update date, content, status, etc. In other words, the ID is an identifier for all post/page-related data. Sometimes, a plugin may ask you to enter the ID of a post or page where you don’t want the plugin to show a meta box or to add/not add something. In this case, you must find out the ID using one of the following two methods:

Page ID in the database

WordPress posts table

To find the page’s ID, open the PHPMyAdmin, terminal after logging in to the DB service and run the following SQL query:

select ID from database_name.prefix_posts where post_title="name of the title";

Before executing the above query, replace database_name with the name of your database, prefix by the prefix you’ve set for the WP database tables, and the name of the title with the post title. When you make these changes and run the SQL query, MySQL will show the post ID.

Page ID in URL

WordPress page ID

This is the easiest method to find page ID in WordPress. Log in to the WP dashboard and click on the page or post of your choice. The WP content management system will now open the editor. In the browser’s address bar, you will find a URL with query parameters. One of the parameters would be post = x where x is a number. This number is nothing but the ID you’re looking for i.e. the page ID.

Closing words: As you can see above, it is easy to find page ID in WP. If you want to know the ID of any post or page on your WP site, use one of the above two methods to find it.

pramod
Pramod

Pramod is the founder of wptls. He has been using WordPress for more than nine years. He builds web applications, and writes about his experiences with various WP products on this site.

Leave a Reply

Your email address will not be published. Required fields are marked *