I currently use an sql query to produce a private page which lists all pages with their id. (It's a quick-check to help exclude some pages from search and site-map.)

For easier formatting, I'm wondering if there's a way to use list_pages (because of the formatting) to also show the ids?

Alternately, how do I list all pages and ids using Wp_Query or get_pages?

I've read 'get all page IDs from wp_list_pages' (get all page IDs from wp_list_pages), but don't know what to add to get it to display results.

1 Answer 1


To list all page title and id, you can try this code!

  $page_ids= get_all_page_ids();
    echo '<h3>My Page List :</h3>';
       foreach($page_ids as $id)
            echo '<br />'.get_the_title($id).' ' .$id;

click here for more info

  • Thanks. I'd seen that page,, but didn't know how to modify the code.
    – glvr
    Nov 27, 2017 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.