Updater::autodetect_source_migration()

Migration to the Smart URL/Autodetect Source.

Contents


Source

File: src/Tribe/Updater.php

	public function autodetect_source_migration() {
		$args = [
			'posts_per_page' => 1000,
			'meta_query' => [
				[
					'key' =>  Event_Meta::$key_virtual,
					'value' => Event_Meta::$key_video_source_id,
				],
			],
		];

		$virtual_events = tribe_events()->by_args( $args )->get_ids();

		foreach ( $virtual_events as $event_id ) {
			$event = tribe_get_event( $event_id );

			// Safety check.
			if (
				Event_Meta::$key_video_source_id !== $event->virtual_video_source ||
				$event->virtual_autodetect_source
			 ) {
				continue;
			}

			// Default to oembed as the autodetect source.
			update_post_meta( $event->ID, Event_Meta::$key_autodetect_source, Event_Meta::$key_oembed_source_id );
		}
	}

Top ↑

Changelog

Changelog
Version Description
1.8.0 Introduced.