Exclude page ID AND current page from wp_query of a Parent page

You can use get_the_ID() to retrieve the current page’s ID. $current_page_id = get_the_ID(); $args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ‘post_parent’ => ‘2’, ‘post__not_in’ => array( 4, $current_page_id ), ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order’ ); This kind of ID exclusion may cause query performance issues, especially when you have a great number … Read more