Check if a page is a Sub Page // If outside the loop. $post = get_post(); if ( is_page() && $post->post_parent ) { // This is a subpage } else { // This is not a subpage } Source: https://developer.wordpress.org/reference/functions/is_page/#comment-372