cptui_updated_post_type_slug_exists

Handles slug_exist checks for cases of editing an existing post type.

Description

cptui_updated_post_type_slug_exists( (bool) $slug_exists, (string) $post_type_slug = '', (array) $post_types = array() ); 

Parameters (3)

0. $slug_exists (bool)
Current status for exist checks.
1. $post_type_slug — Optional. (string) => ''
Post type slug being processed.
2. $post_types — Optional. (array) => array()
CPTUI post types.

Usage

  1. if ( !function_exists( 'cptui_updated_post_type_slug_exists' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/post-types.php'; 
  3.  
  4. // Current status for exist checks. 
  5. $slug_exists = true; 
  6.  
  7. // Post type slug being processed. 
  8. $post_type_slug = ''; 
  9.  
  10. // CPTUI post types. 
  11. $post_types = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = cptui_updated_post_type_slug_exists($slug_exists, $post_type_slug, $post_types); 
  15.  

Defined (1)

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

/inc/post-types.php  
  1. function cptui_updated_post_type_slug_exists( $slug_exists, $post_type_slug = '', $post_types = array() ) { 
  2. if ( 
  3. ( ! empty( $_POST['cpt_type_status'] ) && 'edit' == $_POST['cpt_type_status'] ) && 
  4. ! in_array( $post_type_slug, cptui_reserved_taxonomies() ) && 
  5. ( ! empty( $_POST['cpt_original'] ) && $post_type_slug === $_POST['cpt_original'] ) 
  6. $slug_exists = false; 
  7. return $slug_exists;