Skip to content

Instantly share code, notes, and snippets.

@5iDS
Created February 20, 2014 02:15
Show Gist options
  • Select an option

  • Save 5iDS/9105797 to your computer and use it in GitHub Desktop.

Select an option

Save 5iDS/9105797 to your computer and use it in GitHub Desktop.
Check if a Page is a Child of Another Page in WordPress
#-----------------------------------------------------------------
# Check if a Page is a Child of Another Page in WordPress
# Returns true if a match was found.
#
# @param int $pageID
#
# @return bool
#
#-----------------------------------------------------------------
function is_childPage($pageID) {
global $post;
if( is_page() && ($post->post_parent==$pageID) ) {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment