Tribe__Events__Aggregator__Records::get_by_event_id( int $event_id )

Returns an appropriate Record object for the given event ID.


Parameters

$event_id

(int) (Required) Post ID of the Event.


Top ↑

Return

(Tribe__Events__Aggregator__Record__Abstract|WP_Error)


Top ↑

Source

File: src/Tribe/Aggregator/Records.php

	public function get_by_event_id( $event_id ) {
		$event = get_post( $event_id );

		if ( ! $event instanceof WP_Post ) {
			return tribe_error( 'core:aggregator:invalid-event-id', array(), array( $event_id ) );
		}

		$record_id = get_post_meta( $event->ID, Tribe__Events__Aggregator__Event::$record_key, true );

		if ( empty( $record_id ) ) {
			return tribe_error( 'core:aggregator:invalid-import-id', array(), array( $record_id ) );
		}

		return $this->get_by_post_id( $record_id );

	}

Top ↑

Changelog

Changelog
Version Description
4.3.0 Introduced.