protected function get_id($object)
{
$this->id = false;
if (is_numeric($object)) {
$this->id = $object;
} elseif (is_array($object)) {
$object = array_change_key_case($object, CASE_UPPER);
if (array_key_exists('ID', $object)) {
$this->id = $object['ID'];
}
} elseif (is_object($object)) {
if ($object instanceof WP_REST_Response) {
return $this->get_id($object->get_data());
} elseif ($object instanceof WP_REST_Request) {
$this->id = $object->get_param('id');
} elseif (isset($object->ID)) {
$this->id = $object->ID;
} elseif (isset($object->comment_ID)) {
$this->id = $object->comment_ID;
} elseif (isset($object->term_id)) {
$this->id = $object->term_id;
}
}
$this->id = absint($this->id);
return $this->id;
}