PodsAPI::delete_object PHP 메소드

delete_object() 공개 메소드

$params['id'] int The object ID $params['name'] string The object name $params['type'] string The object type
부터: 2.0
public delete_object ( array | object $params ) : boolean
$params array | object An associative array of parameters
리턴 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;
    }