public function ajax_redirect_add() { global $hook_suffix; $hook_suffix = ''; $this->check_ajax_referer('redirection-redirect_add'); $item = Red_Item::create($_POST); if (is_wp_error($item)) { $json['error'] = $item->get_error_message(); } elseif ($item !== false) { $pager = new Redirection_Table(array()); $json = array('html' => $pager->get_row($item)); } else { $json['error'] = __('Sorry, but your redirection was not created', 'redirection'); } $this->output_ajax_response($json); }