tribe_update_event_with_series( WP_Post $event, WP_Post $series )
Updates an Event to be attached to a given Series post.
Contents
Parameters
- $event
-
(WP_Post) (Required) A reference to the Event post.
- $series
-
(WP_Post) (Required) A reference to the Series post.
Return
(bool) Whether the Event was attached to the Series or not.
Source
File: src/functions/template-tags/general.php
function tribe_update_event_with_series( WP_Post $event, WP_Post $series ): bool { if ( TEC::POSTTYPE !== $event->post_type || Series::POSTTYPE !== $series->post_type ) { return false; } if ( Event::upsert( [ 'post_id' ], Event::data_from_post( $event->ID ) ) === false ) { return false; } $event_model = Event::find( $event->ID, 'post_id' ); if ( ! $event_model instanceof Event ) { return false; } tribe( Relationship::class )->with_event( $event_model, [ $series->ID ] ); return true; }
Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |