I am getting problem to fetch records with WP_QUERY in wordpress. I have a working custom Query but I need this query in the form of WP_QUERY.
Select * from wp_posts where post_type = 'awards' AND post_status = 'publish' AND ID < '$lastmsg' order by ID desc limit 4;
My Arguments for WP_QUERY
$args = array(
'post_type' => 'awards',
'post_status' => 'publish',
'posts_per_page' => 4,
'meta_query' => array(
array(
'key' => 'ID',
'value' => $POST_ID,
'compare' => '<'
)
)
);
Please help me. Thank in advance.
Here is the alternative solution for your problem. I hope it will work for you.
This code have the same functionality as we use have posts query.