Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $wpdb;
- $userId = 1; // change as needed
- $sql = "
- SELECT DISTINCT ap.post_id
- FROM {$wpdb->prefix}glsr_assigned_posts ap
- INNER JOIN {$wpdb->prefix}glsr_ratings r ON r.ID = ap.rating_id
- INNER JOIN {$wpdb->posts} p ON p.ID = r.review_id
- WHERE p.post_author = %d AND ap.is_published
- ";
- $postIds = $wpdb->get_col($wpdb->prepare($sql, $userId));
- $posts = new WP_Query([
- 'post__in' => $postIds,
- 'post_status' => 'publish',
- 'post_type' => 'page',
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement