How to Find Your WordPress Page ID and Post ID 

  1. Why would you need to know the page post ID. 00:50
  2. How you can learn what the page ID or post ID is. 03:06 

    Read the full episode transcript below:

    00:27 David Blackmon: Hey, everybody. Welcome to another episode of WP the podcast brought to you by WP Gears. I’m David Blackmon.

    00:34 Tim Strifler: I’m Tim Strifler.

    00:36 David Blackmon: Today we’re going to talk about how to find your WordPress page ID and post ID. This is going to be a short sweet episode but very important. Tim, why don’t you get us kicked off?

    00:48 Tim Strifler: Yeah, absolutely. I guess the first question is, why would you need to know the page post ID? Actually, let me take you one step back and say that everything in WordPress has a post ID with it and actually there’s technically nothing different about a page ID or a post ID. There’s one ID set of numbers for everything in WordPress whether it’s a page, a post, a product, another custom post type, a menu, all of it have post IDs that correspond into the database, and WordPress uses that for organization purposes. If you have a post ID of 234, well, you won’t have a menu ID of 234 because it’s all the same numbering system.

    01:33 Tim Strifler: You might be asking, “Okay, well, that’s great. That’s how WordPress uses it in the database. But why do I need to know that?” The answer is it depends on kind of what you’re doing but there’s some plugins that you’ll need to know the page or post ID for targeting something. Like say for example a pop up plugin and you want to target it just on a specific page or post in some cases you might need to know that ID or there’s other plugins. I think there’s a WooCommerce plugin that I’ve used, that will automatically redirect to a certain page after a product is added to the cart. You can set what you need to know what the product or the post ID is. Whenever that post ID is added to the cart, it will automatically redirect to whatever page you choose. Little things like that.

    02:23 Tim Strifler: It comes up randomly in different situations. Another example is within WordPress, every single page or post has CSS with that page or post ID in the code, and so you can actually target CSS that will only display on that page or post ID. Again, you’ll need a note for that. Then lastly, there’s code snippets you can do to execute certain PHP functions or JavaScript only on a specific post ID. That’s kind of the why. I’m going to kick it over to David, and he’s going to tell you how you can learn what the page ID or post ID is. It’s actually not as complicated as you might think.

    03:06 David Blackmon: That’s right. This is the long portion of the podcast, so buckle up. Keep your hands and feet in the cart at all times. Actually, it’s very easy. Tim is correct. Just simply go over to your WordPress page or post and hover over the link and look at the number that shows up. That’s it folks. It’s that simple. You’re going to see a post ID in the URL, and that’s where you’re going to grab it from. It’s that easy. It even says, “Post ID,” or, “Page ID.” They make it super simple for you, so not rocket science. Pretty easy to do. We hope this helps. Tim, anything else to add?

    04:16 David Blackmon: Absolutely. Well, tomorrow we’ve got another great podcast episode and I must say four episodes in, in 2019 and I’m feeling that already and it’s good to be back. Tim, until tomorrow, we’ll see you then.

    04:32Tim Strifler: Take care. Bye, bye.

    Did you Enjoy this Episode?

    • Will you consider sharing it online? Just click one of the share buttons below!
    • Will you leave us a review? 🙂
    • Have a question, or a topic request? Let us know in the comments below!

    Want to Connect with David & Tim?

    Submit a Comment

    Your email address will not be published.

    Where To Find Us

    Listen to WP The Podcast on your favorite platform: