public function check_name_post_type($data) { global $mf_domain; $type = $data['post_type']; $id = $data['post_type_id']; $check = mf_posttype::check_post_type($type, $id); if ($check) { // exist type(name) in the system $resp = array('success' => 0, 'msg' => __('The Type(name) of Post type exist,Please choose a different type(name).', $mf_domain)); } else { $resp = array('success' => 1); } echo json_encode($resp); }
public function check_exist_visual_editor() { if (strstr($_SERVER['REQUEST_URI'], 'post-new.php') !== FALSE || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') !== FALSE) { if (isset($_GET['action']) && $_GET['action'] == 'trash') { //when the post already exists return; } if (!empty($_GET['post']) && is_numeric($_GET['post'])) { //when the post already exists $post_type = get_post_type($_GET['post']); } else { //Creating a new post $post_type = !empty($_GET['post_type']) ? $_GET['post_type'] : 'post'; } $mf_posttype = new mf_posttype(); $pt = $mf_posttype->get_post_type($post_type); if ($pt && !isset($pt['support']['editor'])) { echo "<style>#postdivrich {display:none; }</style>"; } } }