public function new_category() { if (!isset($_POST['title'])) { die; } check_ajax_referer('fpd_ajax_nonce', '_ajax_nonce'); if (class_exists('Fancy_Category')) { $id = Fancy_Category::create($_POST['title']); header('Content-Type: application/json'); echo json_encode(array('id' => $id, 'message' => $id ? __('Category successfully created!', 'radykal') : __('Category could not be created. Please try again!', 'radykal'), 'html' => FPD_Admin_Manage_Fancy_Products::get_category_item_html($id, $_POST['title']))); } die; }