/** * Adds / removes the event details as meta tags to the post. * * @param int $postId * @param WP_Post $post * */ public function addEventMeta($postId, $post) { static $avoid_recursion = false; // Avoid an infinite loop, because saveEventMeta calls wp_update_post when the post is set to always show in calendar if ($avoid_recursion) { return; } $avoid_recursion = true; $original_post = wp_is_post_revision($post); $is_event_revision = $original_post && tribe_is_event($original_post); if ($is_event_revision) { $revision = Tribe__Events__Revisions__Post::new_from_post($post); $revision->save(); $avoid_recursion = false; return; } $event_meta = new Tribe__Events__Meta__Save($postId, $post); $event_meta->maybe_save(); // Allow this callback to run $avoid_recursion = false; }
/** * Adds / removes the event details as meta tags to the post. * * @param int $postId * @param WP_Post $post * */ public function addEventMeta($postId, $post) { $original_post = wp_is_post_revision($post); $is_event_revision = $original_post && tribe_is_event($original_post); if ($is_event_revision) { $revision = Tribe__Events__Revisions__Post::new_from_post($post); $revision->save(); return; } $event_meta = new Tribe__Events__Meta__Save($postId, $post); $event_meta->maybe_save(); }