I am looking for a way to output all page IDs from the following menu:
<?php wp_list_pages('depth=1&exclude='3,5,11')); ?>
Only top level pages needed, therefore the 'depth=1'.
Any help appreciated.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
You can do this with
$args = array( 'post_type' => 'page', 'post_parent' => 0, 'fields' => 'ids', 'posts_per_page' => -1, 'post__not_in' => array('3','5','11'), ); $qry = new WP_Query($args); var_dump($qry->posts);
As you can see from the
$qry->posts is an array of