WC_Data::delete
Delete an object, set the ID to 0, and return result.
Метод класса: WC_Data{}
Хуки из метода
Возвращает
true|false. result
Использование
$WC_Data = new WC_Data(); $WC_Data->delete( $force_delete );
- $force_delete(true|false)
- Should the date be deleted permanently.
По умолчанию: false
Список изменений
| С версии 2.6.0 | Введена. |
Код WC_Data::delete() WC Data::delete WC 10.4.2
public function delete( $force_delete = false ) {
/**
* Filters whether an object deletion should take place. Equivalent to `pre_delete_post`.
*
* @param mixed $check Whether to go ahead with deletion.
* @param WC_Data $this The data object being deleted.
* @param bool $force_delete Whether to bypass the trash.
*
* @since 8.1.0.
*/
$check = apply_filters( "woocommerce_pre_delete_$this->object_type", null, $this, $force_delete );
if ( null !== $check ) {
return $check;
}
if ( $this->data_store ) {
$this->data_store->delete( $this, array( 'force_delete' => $force_delete ) );
$this->set_id( 0 );
return true;
}
return false;
}