Tribe__Events__Aggregator__Records::get_by_post_id( int $post )

Returns an appropriate Record object for the given post ID.


Parameters

$post

(int) (Required) The post ID of the record.


Top ↑

Return

(Tribe__Events__Aggregator__Record__Abstract|WP_Error|null)


Top ↑

Source

File: src/Tribe/Aggregator/Records.php

	public function get_by_post_id( $post ) {
		$post = get_post( $post );

		if ( is_wp_error( $post ) ) {
			return $post;
		}

		if ( ! $post instanceof WP_Post ) {
			return tribe_error( 'core:aggregator:invalid-record-object', array(), array( $post ) );
		}

		if ( $post->post_type !== self::$post_type ) {
			return tribe_error( 'core:aggregator:invalid-record-post_type', array(), array( $post ) );
		}

		if ( empty( $post->post_mime_type ) ) {
			return tribe_error( 'core:aggregator:invalid-record-origin', array(), array( $post ) );
		}

		return $this->get_by_origin( $post->post_mime_type, $post );
	}

Top ↑

Changelog

Changelog
Version Description
4.3.0 Introduced.