Wordpress

Get Post ID | Wordpress Tutorial

By

This is a Wordpress tutorial on how to get post ID of the current page/post inside a widget.

Step 1:

Visit your website.

Visit your website


Step 2:

If you check the URL bar, it will not show your page ID. Go to “Inspect” tools by right clicking on your page, then selecting “Inspect”. Or you can use the shortcut Ctrl+Shift+I.

If you check the URL bar, it will not show your page ID. Go to “Inspect” tools by right clicking on your page, then selecting “Inspect”. Or you can use the shortcut Ctrl+Shift+I.



Step 3:

In the “Elements” tab you can find the “body class”. It contains the Page ID. In this example, the Page ID is 2366.

In the “Elements” tab you can find the “body class”. It contains the Page ID. In this example, the Page ID is 2366.


Step 4:

You can also use “Find” (Ctrl+F) and type in “Page ID” to highlight the Page ID.


Step 5:

Go to “Dashboard”, then select “Posts”. 

Go to “Dashboard”, then select “Posts”. 


Step 6:

Select a post you want to preview. 

Select a post you want to preview. 



Step 7:

The URL bar contains your Post ID which is 6398 in this example. You can use these numbers if you’re pulling an ID for a post/page. 

The URL bar contains your Post ID which is 6398 in this example. You can use these numbers if you’re pulling an ID for a post/page. 


Step 8:

You can also go to your “Inspect” tools by right clicking, then selecting “Inspect” or Press Ctrl+F. If you check the article, you can find the Post ID.

You can also go to your “Inspect” tools by right clicking, then selecting “Inspect” or Press Ctrl+F. If you check the article, you can find the Post ID.


Hope this helps!


Tags
No items found.

Stay updated with our
latest news & offers

Sign up to get our Newsletter.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.