Check if post has children or not
You can first attempt and get a list of post’s children. If the returned value was empty, then the post has no child. Here’s how you do it: $args = array( ‘post_parent’ => get_the_ID(), // Current post’s ID ); $children = get_children( $args ); // Check if the post has any child if ( ! … Read more