page id Tag

Finding the Page ID Numbers in WordPress

19th of July, 2009 in the year of our Lord

When developing a WordPress theme, it’s helpful to know a specific page’s ID number at times.

For instance, I’m working on a site now where I want to display some pages in the sidebar, but not all, so I use the template tag “wp list pages” and the parameter “exclude.”

Here’s how the code looks:
<?php wp_list_pages(‘title_li=&exclude=PAGE_ID’); ?>

Problem is, I don’t know the page IDs and it’s not listed anywhere in Pages > Edit. However if you choose a specific page to edit, the URL in the navigation bar will end in “post=PAGE_ID”.

If you need multiple page IDs, go to Pages > Edit. The URL that titles point to ends in the page ID. In Firefox you can just hover over the link and look in the status bar at the bottom of the screen.

My code ended up looking like this:
<?php wp_list_pages(‘title_li=&exclude=2, 308, 310, 312’); ?>

RSS

Subscribe

Separator