Tribe__Events__Aggregator__Records::get_by_event_id( int $event_id )
Returns an appropriate Record object for the given event ID.
Contents
Parameters
- $event_id
-
(int) (Required) Post ID of the Event.
Return
(Tribe__Events__Aggregator__Record__Abstract|WP_Error)
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 );
}
Changelog
| Version | Description |
|---|---|
| 4.3.0 | Introduced. |