Try this
$args = array(
'post_type' => 'book',
'posts_per_page' => -1,
);
$query = new WP_Query($args);
while($query->have_posts() ) : $query->the_post();
$date = get_post_meta( get_the_ID(), 'date_all', true );
if($date['year'] >= 2018 && $date['month'] == 3){
the_title();
}
endwhile; wp_reset_query();
Related Posts:
- Return only Count from a wp_query request?
- WP_Query: query posts by ids from array?
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- How to uniquely identify queries?
- pre_get_posts with get_posts
- author.php with ACF and CPTs
- Query Custom Meta Value with Increment
- Identify which loop you are hooking into; primary or secondary?
- WP_Query ordered by custom field that is a date string?
- How to make an activities stream mixing posts and comments?
- Duplicate Queries
- How to query for a week using key => value WP_Query argument notation?
- SQL query equivalent to WP User Query
- How to count post type that has a particular term?
- Finding the next 5 posts
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- view queries made?
- meta_query on a date range using an array of values
- WP_Query Performance Issues with meta_query
- How to detect custom query inside `posts_where` hook?
- Pass the same object to multiple widgets in a template with one query
- Is temporarily overwriting $wp_query a bad idea?
- How to output different posts per page?
- What is considered a default query for the request filter?
- $wpdb insert is not work
- Pass array of taxonomy terms to wp_query
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- merge two query arguments into one WP_Query call
- Using WP_Query in “parse_query” or “pre_get_post” in Posts2Posts
- Query: offset post list, unless it’s a specific category
- How to reduce the number of queries?
- How to query a custom post type with a taxonomy filter but display post type archive page?
- List of the years with posts presented
- Query custom post type by custom taxonomy (category slug)
- Change query_posts to WP_Query in page but does not work
- Optional Meta Query
- Set conditional on template based on referring page slug
- Editing the default wordpress search
- Iterating through $wpdb query without using get_results for large query results
- Weird orderby => post__in issue
- Slow page loads due to WordPress Core Query
- Filter posts in category archive page by year using a dropdown
- Set global $wp_query/$post variable for dynamic page generation
- WP_Query with ‘rand’, but equal number of posts from the taxonomy terms given
- Include data from custom table in WP_Query
- Meta Query relation “AND” then set array accordingly
- How to get a query variable?
- date_query seems to be ignored by wp_query
- Is there a reason why Pages are not publicly_queryable?
- Check return value of get_posts
- Exclude some authors from query
- Sort WordPress Posts Meta value by Week not Day
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- Transient api Caches confused
- How can I override one post and make it display content for another post?
- Get multiple users with meta value in one query and populate WP_User class
- How to check the array values, what WP_Query has brought to me?
- How to add custom meta to ‘pre_get_terms’?
- Should I reset $wp_query?
- Query where ANDing slug values not working
- How to filter query loop block with a search string from the query parameters
- Get specific ACF key and value from all posts – no access to DB
- How to SQL query posts IDs by categories AND authors?
- I am officially missing something about transient posts
- Start Query from 2nd Post without offset
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- Post incorrectly excluded when using “category__in”?
- Query multiple post types, but different order for each
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Query against multiple locations within single custom post type post
- How to get_comments() ordered by date and parent?
- WP Query. Ordering posts by another post types meta
- How to make a search query if not found in post table then search in postmeta table?
- Create global array to compare inside a query
- How to show terms from another taxonomy
- Ignoring ‘a’ when sorting posts
- how to show more than 1 post into three columns query
- Using the same WP_Query for shop and widgets in WooCommerce shop
- How can I get all the posts that are related with a specific taxonomy term?
- Custom query for tag and custom tag from 2 post type
- Filter posts/pages by user_role array
- WP_Query secondary query failing
- Pagination in custom query in a category page
- Get a list of the last posts grouped by author and filtered by category
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to query post ids liked by the Author
- Modify query after meta value
- Custom post types loop on a page template
- Get the number of rows from $wpdb->get_results not working
- Pagination in WP query with transient API
- Parsing External Table Arguments
- difference between methods of query
- Query posts by meta value and sort by another meta key
- how to use transient method?
- Main loop querying current template’s info only in custom category archive pages, not my posts
- Use meta query only 3 or more results?
- How to use meta_query to retrieve posts from multiple custom post type
- Rewrite URL custom search query
- posts_per_page showing 16 elements instead of 3