status = $status; $this->meta = $meta; } function send() { WPFunctions::get()->statusHeader($this->status); $data = $this->getData(); $response = []; if (!empty($this->meta)) { $response['meta'] = $this->meta; } if ($data !== null) { $response = array_merge($response, $data); } if (!empty($response)) { @header('Content-Type: application/json; charset=' . get_option('blog_charset')); echo WPFunctions::get()->wpJsonEncode($response); } die(); } abstract function getData(); }