is_post_type_hierarchical

Whether the post type is hierarchical.

Description

is_post_type_hierarchical( (string) $post_type ); 

A false return value might also mean that the post type does not exist.

Parameters (1)

0. $post_type (string)
The post type.

Usage

  1. if ( !function_exists( 'is_post_type_hierarchical' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // The post type. 
  5. $post_type = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = is_post_type_hierarchical($post_type); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function is_post_type_hierarchical( $post_type ) { 
  2. if ( ! post_type_exists( $post_type ) ) 
  3. return false; 
  4.  
  5. $post_type = get_post_type_object( $post_type ); 
  6. return $post_type->hierarchical;