ActionScheduler_wpPostStore::cancel_action()publicWC 1.0

Cancel action.

Method of the class: ActionScheduler_wpPostStore{}

Hooks from the method

Return

null. Nothing (null).

Usage

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->cancel_action( $action_id );
$action_id(int) (required)
Action ID.

ActionScheduler_wpPostStore::cancel_action() code WC 8.6.1

public function cancel_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', 'woocommerce' ), $action_id ) );
	}
	do_action( 'action_scheduler_canceled_action', $action_id );
	add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 );
	wp_trash_post( $action_id );
	remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 );
}