Get direct successor of given ID
-
Hi,
I want to get the direct successor of a page. E.g.
[3] Products
—-[7] Steel
——[12] Nails
——[14] Miscellaneous
—-[8] Plastic
—-[9] OtherI want the child pages of products. So I would get steel, plastic and other. How do I do that?
I tried this:
$my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array('post_type' => 'page')); $res = get_page_children($currentPageID, $all_wp_pages);
This gives me also nails and miscellaneous. But I don’t want these two. I also tried
$args = array('numberposts' => '25', 'post_type' => 'page', 'post_status' => 'publish'); $res = get_page_children($currentPageID, get_posts($args));
Same result. I also tried with
$args = array('numberposts' => '25', 'post_type' => 'page', 'post_status' => 'publish'); $res = get_page_hierarchy( get_posts($args), $currentPageID );
Same result.
Even this code doesn’t change anything:
$args = array('child_of' => $currentPageID); $res = get_pages($args);
How do I get the direct successor of the given ID? Not the successor of the successor ..
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get direct successor of given ID’ is closed to new replies.