cptui_post_type_slug_exists

Check if we already have a post type of that name.

Description

apply_filters( 'cptui_post_type_slug_exists', (bool) $false, (string) $data_cpt_custom_post_type_name, (array) $post_types ); 

Parameters (3)

0. $false (bool) => false
Assume we have no conflict by default.
1. $data_cpt_custom_post_type_name (string)
The data cpt custom post type name.
2. $post_types (array)
Array of existing post types from CPTUI.

Usage

To run the hook, copy the example below.
  1. $false = apply_filters( 'cptui_post_type_slug_exists', $false, $data_cpt_custom_post_type_name, $post_types ); 
  2.  
  3. if ( !empty( $false ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the cptui_post_type_slug_exists callback 
  2. function filter_cptui_post_type_slug_exists( $false, $data_cpt_custom_post_type_name, $post_types ) { 
  3. // make filter magic happen here... 
  4. return $false
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'cptui_post_type_slug_exists', 'filter_cptui_post_type_slug_exists', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'cptui_post_type_slug_exists', 'filter_cptui_post_type_slug_exists', 10, 3 ); 

Defined (1)

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

/inc/post-types.php  
  1. $slug_exists = apply_filters( 'cptui_post_type_slug_exists', false, $data['cpt_custom_post_type']['name'], $post_types );