ActionScheduler_wpPostStore::delete_action
Delete action.
Method of the class: ActionScheduler_wpPostStore{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore(); $ActionScheduler_wpPostStore->delete_action( $action_id );
- $action_id(int) (required)
- Action ID.
ActionScheduler_wpPostStore::delete_action() ActionScheduler wpPostStore::delete action code WC 10.8.1
public function delete_action( $action_id ) {
$post = get_post( $action_id );
if ( empty( $post ) || ( self::POST_TYPE !== $post->post_type ) ) {
/* translators: %s is the action ID */
throw new InvalidArgumentException( sprintf( __( 'Unidentified action %s: we were unable to delete this action. It may may have been deleted by another process.', 'woocommerce' ), $action_id ) );
}
do_action( 'action_scheduler_deleted_action', $action_id );
wp_delete_post( $action_id, true );
}