Tribe__Events__Main::addPostOrigin( int $postId, WP_Post $post )
Adds the ‘_
Contents
Parameters
- $postId
-
(int) (Required) , the post ID
- $post
-
(WP_Post) (Required) , the post object
Source
File: src/Tribe/Main.php
public function addPostOrigin( $postId, $post ) {
// Only continue of the post being added is an event, venue, or organizer.
if ( isset( $postId ) && isset( $post->post_type ) ) {
if ( $post->post_type == self::POSTTYPE ) {
$post_type = '_Event';
} elseif ( $post->post_type == Tribe__Events__Venue::POSTTYPE ) {
$post_type = '_Venue';
} elseif ( $post->post_type == Tribe__Events__Organizer::POSTTYPE ) {
$post_type = '_Organizer';
} else {
return;
}
//only set origin once
$origin = get_post_meta( $postId, $post_type . 'Origin', true );
if ( ! $origin ) {
add_post_meta( $postId, $post_type . 'Origin', apply_filters( 'tribe-post-origin', 'events-calendar', $postId, $post ) );
}
}
}