wc_get_page_children()
Recursively get page children.
No Hooks.
Return
Int[]
.
Usage
wc_get_page_children( $page_id );
- $page_id(int) (required)
- Page ID.
wc_get_page_children() wc get page children code WC 9.3.1
function wc_get_page_children( $page_id ) { $page_ids = get_posts( array( 'post_parent' => $page_id, 'post_type' => 'page', 'numberposts' => -1, // @codingStandardsIgnoreLine 'post_status' => 'any', 'fields' => 'ids', ) ); if ( ! empty( $page_ids ) ) { foreach ( $page_ids as $page_id ) { $page_ids = array_merge( $page_ids, wc_get_page_children( $page_id ) ); } } return $page_ids; }