Tribe__Cache::delete_expired_transients()

Purge all expired tribe_ transients.

This uses a modification of the the query from https://core.trac.wordpress.org/ticket/20316


Return

(void) Just execute the database SQL no return required.


Top ↑

Source

File: src/Tribe/Cache.php

	public function delete_expired_transients() {
		global $wpdb;

		$time = time();

		$sql = "
			DELETE
				a,
				b
			FROM
				{$wpdb->options} a
				INNER JOIN {$wpdb->options} b
					ON b.option_name = CONCAT( '_transient_timeout_tribe_', SUBSTRING( a.option_name, 12 ) )
					AND b.option_value < {$time}
			WHERE
				a.option_name LIKE '\_transient_tribe\_%'
				AND a.option_name NOT LIKE '\_transient\_timeout_tribe\_%'
		";
		$wpdb->query( $sql );
	}

Top ↑

Changelog

Changelog
Version Description
4.11.0 Introduced.