WordPress Page id: How to Find and Use it

WordPress page id
Do you want to find the WordPress page ID on your WordPress website? In this blog, we will discuss how to find the page ID easily. Every single WordPress page or a post has some unique number. This number is helpful to find the publication or a page within seconds. When you arrange the program operation or a blog it will be very easy to use. You can use some plugins to find out the page ID. You need to find page ID because WordPress will never give you a solution to establish a post or page ID in the admin panel. We will discuss 6 different ways to get a unique number of pages, pages, or categories. Process of finding these numbers are very easy as same as we use WordPress. Let us get started.

Where you can find page ID?

1. Via the WordPress console

WordPress page URL consists of Page ID.
You have to visit the console then click on pages. After this select any page so that in the edit screen you will get URL which consists of number something like post=618action=edit. In this example, your page’s unique number is 61.

url consists Page ID

In the same way you will be able to find the category ID.
To find category ID visit to the console click on posts and click on categories or a tags. After this open the edit list and get the unique category from URL.

category id

In the above screenshot you will be able to find that the unique number of category is 1. In the console you can also find media applicable number that can be used to create a gallery shortcode. Example is given below

gallery shortcode

2. Find a unique number with the help of WordPress plugins

Yes finding a unique number or a WordPress page ID is a simple task in WordPress console but sometime it might not give you effective results especially when you are working with these unique numbers for a longer time. Therefore another effective solution to find unique id is to add plugins name Show Pages IDs on WordPress that will help you by adding all the unique numbers of

  • Media library items.
  • All tags and categories.
  • Posts and pages.
  • Custom post types.

Because these plugins are light weighted and included with small 100 lines of code without front end requirements your website will perform well plus it will never slow down your website speed.

Check the example of how it looks like

uncheck box screen

If you don’t want to showcase the column then you just have to uncheck the ID box in screen option.

3. With the help of phpMyAdmin

PhpMyAdmin is a space on website hosting where you are able to handle the website database.
In your web browser, you can easily access PHP based frontend cpanel. Even if you want you can download it on your website. You can also find some guidance on the web to know how to install it. This plugin is very useful and easy to use when you look for work with searches, databases, handling MySQL, backups, etc.

So you need to go to the frontend cpanel and then go to wp_posts. In the database table, you will get the post ID.
An example is shown below

db post id

4. In PHP Post Object

If you know some basics of PHP then you will found that this trick will be helpful for you. In this method, in the post object, you will be able to find the WordPress page ID. If you are unaware of post ID then we will be using the global post object.

The code of the post is shown below

Global $post;
Echo $post->ID;

5.Via title get the ID

This is the extraordinary way to get the WordPress page ID via page or a post title. get_page_by_title()
This method is useful to find out any type of post ID
Find ID in WP_Query loop
You can also find the post object properties with WP_Query instead of using the function.
An example is given below

Via title get the ID

These all are the best and easiest methods to find the WordPress page ID. Now let us discuss the issues
How you can find lots of pages and post ID faster?

If you are looking to find out the fastest way to find the different posts and pages IT then page and post finder will help you out. You might know about Show IDs by 99 Robots but something new is for you i.e. Reveal IDs.
Reveal IDs are easy to use as compare to Show Ids by 99 Robots. You just have to install the plugin and it will show you all ID categories pages, media tags, posts, etc.

media tags, posts

Because you don’t have to search each and every Id manually you will save a lot of time.
When you click edit mode, you just have to hover a mouse on a post or a page name rather than opening a page. You will find the status bar. Thus you will get the post ID. Using this method you will be able to find different post IDs in a few minutes.

How you can find WordPress category ID

Some of the methods that are mentioned above are also useful to find the WordPress category ID. You can use WordPress plugin to find the ID or you can use the WordPress console to find categories ID.

Even you can find it manually as mentioned in the previous description. In WordPress console open the edit mode of category and you just have to take a mouse on the category name. Below this, you will get the status bar with category ID.

In URL you will find tag_ID=X where X will indicate the category unique number or an ID.
Check the example below

permalink by ID

How you will get the permalink by ID?

File using this function you can get permalink by ID
get_permalink( int|WP_Post $post, bool $leavename = false )
Below this, you will get more details about the function and how it uses it.

  • It gets links for all types of pages, and posts.
  • To use it in PHP, get the permanent link for the post.
  • It gets variable and does not showcase on the screen.

For the WordPress cycle, you can use first parameter $id-ID of WordPress post.
If you are failed to mention the ID parameter and function on archive pages like author based archives, categories, etc then this function will give you the recent post link.

An example is shown below
Consider a link to the current post. The function will not showcase the details. Hence you require to make use of PHP inquiry echo:

<?php echo get_permalink(); ?>

Now let us consider link for some posts. You will have to showcase the page links with ID1 to ID 10.
<ul>
<li><a href=”<?php echo get_permalink(1); ?>”>About blog </a></li>
<li><a href=”<?php echo get_permalink(10); ?>”>About author</a></li>
</ul>

through 2nd parameter let do not change %postname% tag. Suppose it has the following structure in SEF i.e. %post_id%/%postname% then the function ill get executed like
<?php echo get_permalink(185, true ); ?>
Which will showcase the link?
http://example.com/185/%postname%

Where these pages get stores?

In WordPress, the publications which you create are not captured in the form of different files but in the database. In a web browser when any user types the address. The server gets the code of PHP that get the details from database. so that all the information gets files within some seconds.

From the cash server or a browser, the pages are downloadable with the help of cash plugins on the WordPress website. But all edits can be done in the admin dashboard. a page can be shown on the website similar to another post. The variance is that it does not have social buttons, comments, and publications.
You need to visit the phpMyAdmin with data provided by hosting server while registration, to get all details related to pages.

Select the database(1)>wp_posts folder(2).

posts information

At the right-hand side check the publications and posts information
post_content –the content of the publication.

post_title – the publication’s title.
post_type – on the page in the category “page”, it specifies the publication type.
For most of the pages, you will get the categories for revision. These pages are building automatically which are not even useful. To maximize the space in a database you should delete all those revisions. If you find that there are so many pages of revisions that need to be deleted then you need to get SQL and add this code in SEQL inquiry box
DELETE FROM wp_posts WHERE post_type = “revision”;

By doing this all revisions pages will get destroyed.

But do not forget to build a backup of the database. Because one single code can destroy your past 1 month data.

Conclusion:
The methods mentioned above for finding and using WordPress page ID along with the unique number of tags, posts, categories, media libraries will look like a difficult task but they are not so much complicated. We hope that the methods listed above will help you to perform tasks faster.

Thank you for visiting SKT Themes a place for selecting top WordPress Themes from a list of several hundred templates. Happy Reading and Shopping.