function the_ng_status($id) { echo get_ng_status($id); }
<?php $gallery_id = sanitize_text_field($_GET['ng_id']); $gallery_status = sanitize_text_field($_GET['ng_status']); $old_status = get_ng_status($gallery_id); if (!isset($gallery_id)) { die('Error. No <code>ng_id</code>.'); } else { if (!isset($gallery_status)) { die('Error. No <code>ng_status</code>.'); } } global $wpdb; $update_query = $wpdb->update('nice_gallery', array('gallery_status' => $gallery_status), array('id' => $gallery_id)); if (!$update_query) { $response_code = 0; } else { $response_code = 1; } echo json_encode(array('response_code' => $response_code, 'old_status' => $old_status, 'new_status' => $gallery_status));