I’m going to cover two different no-code ways to get the ID of any post on a WordPress site you control. First, I’ll cover how to find the WordPress post ID with the web page’s HTML, then we’ll locate the numeric ID of the post by editing that post.
Option 1: Find a WordPress Post ID in the Page HTML
Here’s how to find the WordPress post ID of a WordPress site when you’re not even logged in.
- Navigate to the page of your WordPress site you’d like to determine the numeric page ID for.
- In your web browser, view the source of the webpage. The way I most-often do this is with a right-click on a empty part of the web page, and a click on “View Page Source” (or similar) in the contextual menu.
- When you’ve got a mish-mash of HTML from the page (most often opened in a new browser tab) before you, you’ll want to search that (most easily invoked with a CMD or CTRL+F keyboard shortcut) for the string “postid-“. Usually you’ll find attached to a body tag in a WordPress site that HTML/CSS class, and the numeric post ID. So it’ll look like
postid-1234
. That’s precisely your numeric post ID.

👋 If you’re looking for an ID of a WordPress page, you should search for “page-id-“ instead of “postid-“.
Option 2: Find the WordPress Post ID by Editing the Post
This is probably the easiest way for most people. The only downside: you must be logged into the WordPress site. That’s kind of step-zero of this method of find the page ID. After that it’s pretty simple:
- Navigate to the page of your WordPress site you’d like to determine the numeric post ID for. (You should be logged in to WordPress in the browser window you’re doing this in.)
- Because you’re logged in, the “admin bar” should be showing across the top of your WordPress site. If it is, click “Edit Post.”
- On the resulting page, look at your web browser’s URL bar (you may need to click into that bar to see the important part). In the URL, you’ll see a segment that looks something like
?post=1234
. That 1234 (yours probably won’t be 1234 😛) is the numeric ID orpost_id
of this specific WordPress post.

Developer? Here’s the Answer You Might Have Been Seeking
If you’re happy with the above, the below is superfluous. But I can imagine a developer or two finding this page, wanting the WordPress PHP function to find the post ID.
If that’s you, the most-often-right answer is get_the_ID()
. That relies on you being within the WordPress loop, but for most of the time I’m looking to do this as a WordPress developer, I am within the loop, or close enough for get_the_ID()
to work.
Outside the Loop, you might want to use get_queried_object_id()
for post ID retrieval.
Hope that’s helpful 🙂
If anyone looking to get WordPress post ID outside of the loop, you can use the following code.
global $post;
echo $post->ID;