| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
global $current_user,$wpdb; |
| 6 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;} |
| 7 |
|
| 8 |
$cat_id = isset($_POST) && isset($_POST['cat_id']) ? intval(sanitize_text_field($_POST['cat_id'])) : 0; |
| 9 |
if (!$cat_id) {exit;} |
| 10 |
|
| 11 |
$cat_name = isset($_POST) && isset($_POST['cat_name']) ? sanitize_text_field($_POST['cat_name']) : ''; |
| 12 |
if (!$cat_name) {exit;} |
| 13 |
|
| 14 |
$values= array( |
| 15 |
'name'=>$cat_name |
| 16 |
); |
| 17 |
$wpdb->update($wpdb->prefix.'wppm_project_categories',$values,array('id'=>($cat_id))); |
| 18 |
echo '{ "sucess_status":"1","messege":"Success" }'; |
| 19 |
?> |