PodsAPI::delete_object PHP Method

delete_object() public method

$params['id'] int The object ID $params['name'] string The object name $params['type'] string The object type
Since: 2.0
public delete_object ( array | object $params ) : boolean
$params array | object An associative array of parameters
return boolean
    public function delete_object($params)
    {
        $params = (object) $params;
        $object = $this->load_object($params);
        if (empty($object)) {
            return pods_error(sprintf(__("%s Object not found", 'pods'), ucwords($params->type)), $this);
        }
        $success = wp_delete_post($params->id);
        if (!$success) {
            return pods_error(sprintf(__("%s Object not deleted", 'pods'), ucwords($params->type)), $this);
        }
        pods_transient_clear('pods_objects_' . $params->type);
        return true;
    }