ActionScheduler_wpPostStore::cancel_action
Cancel action.
Method of the class: ActionScheduler_wpPostStore{}
Hooks from the method
Returns
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() ActionScheduler wpPostStore::cancel action code WC 10.7.0
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: we were unable to cancel this action. It may may have been deleted by another process.', '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 );
}