• Skip to primary navigation
  • Skip to main content

Genesis Community

Resources for Genesis WordPress Theme Users

  • Facebook
  • Twitter
  • Slack
  • Wiki
  • Login
You are here: Home / Wikis / WordPress / Check if a page is a Sub Page

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

Posted by: Sridhar Katakam Category: WordPress Tags: conditional, subpage

« __(), _e(), esc_html_e() and esc_html__()
Remove Customizer Options »

Copyright © 2026 · Genesis Sample on Genesis Framework · WordPress · Log in