cptui_reserved_post_types

Return an array of names that users should not or can not use for post type names.

Description

(array) cptui_reserved_post_types(); 

Returns (array)

$value Array of names that are recommended against.


Usage

  1. if ( !function_exists( 'cptui_reserved_post_types' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/post-types.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cptui_reserved_post_types(); 
  7.  

Defined (1)

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

/inc/post-types.php  
  1. function cptui_reserved_post_types() { 
  2.  
  3. $reserved = array( 
  4. 'post',  
  5. 'page',  
  6. 'attachment',  
  7. 'revision',  
  8. 'nav_menu_item',  
  9. 'action',  
  10. 'order',  
  11. 'theme',  
  12. 'fields',  
  13. ); 
  14.  
  15. /** 
  16. * Filters the list of reserved post types to check against. 
  17. * 3rd party plugin authors could use this to prevent duplicate post types. 
  18. * @since 1.0.0 
  19. * @param array $value Array of post type slugs to forbid. 
  20. */ 
  21. $custom_reserved = apply_filters( 'cptui_reserved_post_types', array() ); 
  22.  
  23. if ( is_string( $custom_reserved ) && ! empty( $custom_reserved ) ) { 
  24. $reserved[] = $custom_reserved; 
  25. } else if ( is_array( $custom_reserved ) && ! empty( $custom_reserved ) ) { 
  26. foreach ( $custom_reserved as $slug ) { 
  27. $reserved[] = $slug; 
  28.  
  29. return $reserved;