| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user,$wpdb; |
| 7 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;} |
| 8 |
if ( check_ajax_referer( 'wppm_delete_task_priority', '_ajax_nonce', false ) != 1 ) { |
| 9 |
wp_send_json_error( 'Unauthorised request!', 401 ); |
| 10 |
} |
| 11 |
|
| 12 |
$priority_id = isset($_POST) && isset($_POST['priority_id']) ? intval(sanitize_text_field($_POST['priority_id'])) : 0; |
| 13 |
if (!$priority_id) {exit;} |
| 14 |
|
| 15 |
$wpdb->delete($wpdb->prefix.'wppm_task_priorities', array( 'id' => $priority_id)); |
| 16 |
|