Tribe__Events__Linked_Posts::get_linked_posts( int $post_id )
Returns all linked posts for the given post id
Contents
Post collection is indexed by post type
Parameters
- $post_id
-
(int) (Required) Post ID of the object
Return
(array)
Source
File: src/Tribe/Linked_Posts.php
public function get_linked_posts( $post_id ) {
$post_types = $this->get_linked_post_types();
$post_id_post_type = get_post_type( $post_id );
$posts = array();
if ( Tribe__Events__Main::POSTTYPE === $post_id_post_type ) {
foreach ( $post_types as $post_type => $post_type_data ) {
$posts[ $post_type ] = $this->get_linked_posts_by_post_type( $post_id, $post_type );
}
} else {
$post_type = Tribe__Events__Main::POSTTYPE;
$posts[ $post_type ] = $this->get_linked_posts_by_post_type( $post_id, $post_type );
}
/**
* Filters the collection of linked posts for the provided post id
*
* @since 4.2
*
* @param array Collection of posts linked to the post id
* @param int Post ID of the post being looked at
*/
return apply_filters( 'tribe_events_get_linked_posts', $posts, $post_id );
}
Changelog
| Version | Description |
|---|---|
| 4.2 | Introduced. |