Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Post_Relationships::get_related_posts( int $post_id, string $post_type, string $meta_key )
Retrieve an array of post ids related to the deleted post by post type and meta key
Description Description
Parameters Parameters
- $post_id
-
(int) (Required) WP Post ID of the deleted post
- $post_type
-
(string) (Required) WP Post type of the related post(s)
- $meta_key
-
(string) (Required) meta_key to check for relations by
Return Return
(array)
Source Source
File: includes/class.llms.post.relationships.php
private function get_related_posts( $post_id, $post_type, $meta_key ) { global $wpdb; return $wpdb->get_col( $wpdb->prepare( "SELECT p.ID FROM {$wpdb->posts} AS p LEFT JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id AND pm.meta_key = %s WHERE p.post_type = %s AND pm.meta_value = %d", $meta_key, $post_type, $post_id ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.12 | Introduced. |