cptui_process_post_type

Handle the save and deletion of post type data.

Description

cptui_process_post_type(); 

Usage

  1. if ( !function_exists( 'cptui_process_post_type' ) ) { 
  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_process_post_type(); 
  7.  

Defined (1)

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

/inc/post-types.php  
  1. function cptui_process_post_type() { 
  2.  
  3. if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 
  4. return; 
  5.  
  6. if ( ! is_admin() ) { 
  7. return; 
  8.  
  9. if ( ! empty( $_GET ) && isset( $_GET['page'] ) && 'cptui_manage_post_types' !== $_GET['page'] ) { 
  10. return; 
  11.  
  12. if ( ! empty( $_POST ) ) { 
  13. $result = ''; 
  14. if ( isset( $_POST['cpt_submit'] ) ) { 
  15. check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' ); 
  16. $result = cptui_update_post_type( $_POST ); 
  17. } elseif ( isset( $_POST['cpt_delete'] ) ) { 
  18. check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' ); 
  19. $result = cptui_delete_post_type( $_POST ); 
  20. add_filter( 'cptui_post_type_deleted', '__return_true' ); 
  21.  
  22. if ( $result ) { 
  23. add_action( 'admin_notices', "cptui_{$result}_admin_notice" );