Given the page id, check if it has children
The example from the WP codex for get_page_children does what you are looking for with a page titled “Portfolio”: $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array(‘post_type’ => ‘page’, ‘posts_per_page’ => ‘-1’)); // Get the page as an Object $portfolio = get_page_by_title(‘Portfolio’); // Filter through all pages and find Portfolio’s children $portfolio_children = get_page_children( $portfolio->ID, $all_wp_pages … Read more