Your query would be something like:
$post_ids = $wpdb->get_col( "SELECT DISTINCT post_id FROM {$wpdb->prefix}wti_like_post WHERE user_id = {$author->ID}" );
Then you can pass that array of post IDs as the post__in
argument of WP_Query
:
$args = array(
'posts_per_page' => -1,
'post__in' => $post_ids
);
Related Posts:
- Query Custom Meta Value with Increment
- I need query_posts() to order results first by a meta value and then by post ID
- When should you use WP_Query vs query_posts() vs get_posts()?
- order by numeric value for meta value
- Wp get all the sub pages of the parent using wp query
- How to query for most viewed posts and show top 5
- WP_Query vs get_posts
- What is the most efficient way of querying posts based on visits and date for current day?
- Get posts by meta data OR title
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- Pass the same object to multiple widgets in a template with one query
- Retrieve or Query Pages by ID
- How do you query wordpress posts using a math formula between multiple meta field values?
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Page navigation doesn’t show when query category
- Query post with meta_query where date is not in future
- Pull post meta with post_query?
- How to query a custom post type with a taxonomy filter but display post type archive page?
- Change query_posts to WP_Query in page but does not work
- Custom Query num_rows returns wrong amount
- Fetch Record based on meta key dates
- Slow page loads due to WordPress Core Query
- how to make members list directory through wordpress post custom meta key.
- How to increase load time of an archive/search page (WP_Query)
- Query Page Content From Theme Options?
- How can I override one post and make it display content for another post?
- Include current post into loop
- WordPress query posts with multiple post_meta data
- Filter post query to only show direct children of category
- Should I reset $wp_query?
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- Filter products on category AND tag
- How do i create a custom post query when the meta value is an array?
- pre_user_query vs pre_get_posts
- Get posts that match defined arrays of tags
- Query against multiple locations within single custom post type post
- How to show post title in content editor in backend?
- My entry results are not consistently alphabetized
- Merge two queries and remove duplicate
- WP_Query with child element
- Ordering Posts by parent category, name ascending
- Optimising specific Query with ACF meta objects
- How to get several fields from wp_query?
- How to organize a WP_Query’s list of posts by category and display category title?
- When should you use WP_Query vs query_posts() vs get_posts()?
- WordPress Query showing multiple titles
- Query Posts by date range with fixed beginning and end
- custom query to get posts
- query by meta value then date and not empty meta value
- Query posts by meta value and sort by another meta key
- How to get posts that have certain meta key value and order based on another meta key’s value
- Modify WordPress Search
- Nested array issue in meta_query
- Write WP Query that selects posts that are part of the same two categories
- Display post meta conditionally based on it’s value
- Creating attachments archive in tags and categories
- How to use ‘WP_Query’ or ‘query_posts’ to display content in a descending order
- Get next/prev image/attachment in time with date query
- Filtering by multiple conditions in the loop
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- 2 queries with counters
- Show single posts date, in a page of posts
- Sort by custom field that is an array?
- Orderby two meta fields not working
- Max Posts and Memory Limit
- How to SQL query posts IDs by categories AND authors?
- Display count number of posts with the same specific meta_key meta_value
- specific post is not excluded from the loop
- Unable to paginate a custom page query
- Include one page/post into query which is already returning posts
- I am officially missing something about transient posts
- Insert images into wordpress post with a query
- Multiple Query_Posts
- Query posts by searching for a string in a meta field
- Paginate pages with dynamic query
- filter posts by meta key with pagination
- Trouble Making WP_Query paged
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Determine if ID is page or post and query the ID
- How to query for a page, get data, then query for child pages of that page
- Custom template for password protected page
- WP_Query Class custom field parameters
- Start Query from 2nd Post without offset
- Add AJAX “Load more” on custom query block
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Posts limit on homepage (genesis framework)
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Optimising WP_Query with ACF Fields
- meta_query where the meta value is not the post title
- Elementor posts custom query based on tag [closed]
- Query post and sort by custom value calculated with custom field on cpt
- Post incorrectly excluded when using “category__in”?
- Query multiple post types, but different order for each
- Multi-layered WP_Query
- `offset` WP_Query argument dont work via `pre_get_posts`