Function to return true if current page has child pages
Your above function tests whether a page is a child page of some other page, not whether it has children. You can test for children of the current page like so: function has_children() { global $post; $children = get_pages( array( ‘child_of’ => $post->ID ) ); if( count( $children ) == 0 ) { return false; … Read more