/** * This function is used to delete a post type link by the post type link ID. * Note that this will also delete all created links between posts using this post type link. * * @since 1.0.0 * @access public * * @param $ptl_id * * @return bool */ public function delete_post_type_link($ptl_id) { $post_type_link_manager = new SP_Connection_Manager(); return $post_type_link_manager->delete($ptl_id); }
/** * AJAX method to delete link * * @access public * @return void */ public function ajax_delete_link() { // Check if user is allowed to do this if (!current_user_can('manage_options')) { return; } // Check nonce if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], plugin_basename(__FILE__))) { return; } // Delete PT link $pt_type_manager = new SP_Connection_Manager(); $pt_type_manager->delete($_POST['id']); // Generate JSON response $response = json_encode(array('success' => true)); header('Content-Type: application/json'); echo $response; // Bye exit; }