Tribe__Process__Queue::delete_all_queues( string $action )

Deletes all queues for a specific action.


Parameters

$action

(string) (Required) The action (prefix) of the queues to delete.


Top ↑

Return

(int) The number of delete queues.


Top ↑

Source

File: src/Tribe/Process/Queue.php

	public static function delete_all_queues( $action ) {
		global $wpdb;

		$table  = $wpdb->options;
		$column = 'option_name';

		if ( is_multisite() ) {
			$table  = $wpdb->sitemeta;
			$column = 'meta_key';
		}

		$action = $wpdb->esc_like( 'tribe_queue_' . $action ) . '%';

		$queues = $wpdb->get_col( $wpdb->prepare( "
			SELECT DISTINCT({$column})
			FROM {$table}
			WHERE {$column} LIKE %s
		", $action ) );

		if ( empty( $queues ) ) {
			return 0;
		}

		$deleted = 0;

		foreach ( $queues as $queue ) {
			$deleted ++;
			self::delete_queue( $queue );
		}

		return $deleted;
	}

Top ↑

Changelog

Changelog
Version Description
4.7.19 Introduced.