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

Get Page ID WordPress [2024] 💥

Get Page ID WordPress


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


Advertisement

Divi Ad 680px


1. Hover over the page title and get ID

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


Get Page ID WordPress hover over the page title


2. Open the page and get ID

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


Open the Wordpress page and get page-ID


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

By far the nicest solution is to create an extra column that displays the page IDs where all pages 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 page IDs


4. Getting page-ID from WP-database

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


Getting page-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 page ID's are showing in the column.


ID wp-posts


5. Getting page-ID using a plugin

A plugin does just that what we have talked about in chapter 3, it creates a column where your pages are listed with the page 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 page 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 page ID in Wordpress, but these are all involving functions and coding and are definitely not recommended. By the way, the tutorial for "get POST-ID" is here.



Advertisement

Divi Ad 680px



Scroll up