cptui_updated_taxonomy_slug_exists

Handles slug_exist checks for cases of editing an existing taxonomy.

Description

cptui_updated_taxonomy_slug_exists( (bool) $slug_exists, (string) $taxonomy_slug = '', (array) $taxonomies = array() ); 

Parameters (3)

0. $slug_exists (bool)
Current status for exist checks.
1. $taxonomy_slug — Optional. (string) => ''
Taxonomy slug being processed.
2. $taxonomies — Optional. (array) => array()
CPTUI taxonomies.

Usage

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

Defined (1)

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

/inc/taxonomies.php  
  1. function cptui_updated_taxonomy_slug_exists( $slug_exists, $taxonomy_slug = '', $taxonomies = array() ) { 
  2. if ( 
  3. ( ! empty( $_POST['cpt_tax_status'] ) && 'edit' == $_POST['cpt_tax_status'] ) && 
  4. ! in_array( $taxonomy_slug, cptui_reserved_taxonomies() ) && 
  5. ( ! empty( $_POST['tax_original'] ) && $taxonomy_slug === $_POST['tax_original'] ) 
  6. $slug_exists = false; 
  7. return $slug_exists;