EP_API::delete_post PHP Method

delete_post() public method

Delete a post from the ES server given a site ID and a host site ID which is used to determine the index to delete from.
Since: 0.1.0
public delete_post ( integer $post_id, boolean $blocking = true ) : boolean
$post_id integer
$blocking boolean
return boolean
    public function delete_post($post_id, $blocking = true)
    {
        $index = trailingslashit(ep_get_index_name());
        $path = $index . 'post/' . $post_id;
        $request_args = array('method' => 'DELETE', 'timeout' => 15, 'blocking' => $blocking);
        $request = ep_remote_request($path, apply_filters('ep_delete_post_request_args', $request_args, $post_id));
        if (!is_wp_error($request)) {
            $response_body = wp_remote_retrieve_body($request);
            $response = json_decode($response_body, true);
            if (!empty($response['found'])) {
                return true;
            }
        }
        return false;
    }