You need the 2 digit month number that you want to query on and then use the code below. This should be easy with php (for example, see this post). In the code below $month
is the number of the month in a 2 digit format, eg March would be 03.
$start_date = date('Y'.$month.'01'); // First day of the month
$end_date = date('Y'.$month.'t'); // 't' gets the last day of the month
$meta_query = array(
'key' => 'event_start_date',
'value' => array($start_date, $end_date),
'compare' => 'BETWEEN',
'type' => 'DATE'
);
Related Posts:
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- Perform query with meta_value date
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Use meta_query to display events by date in custom field
- How to show recent and upcoming birthdays using meta_query
- How to orderby meta_value_num with dollar ($) sign
- WP_Query meta_query >= date
- Optional Meta Query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- How to orderby multiple meta fields if some fields are empty
- Meta Query relation “AND” then set array accordingly
- date_query seems to be ignored by wp_query
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- How to set up hierarchical relationships without using plugins / meta query
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Show single posts date, in a page of posts
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- meta_query where the meta value is not the post title
- Query multiple post types, but different order for each
- Woocommerce Get Orders By Meta Value
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Comparing Meta Field date in WPQuery using Meta_Query?
- Meta query orderby meta_value_num sorting by role first
- Query against multiple locations within single custom post type post
- Strange results from WP_Query
- WP Query. Ordering posts by another post types meta
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- What is the best way to reset a search on a meta_key / meta_value?
- How can I modify standard search query to include also ACF custom fields values?
- Filter posts/pages by user_role array
- Query custom post type by date field only working when two posts match the query
- Divide WP_Query posts by date & post type
- Query Posts by date range with fixed beginning and end
- Get posts that were most recently tagged
- Use meta query only 3 or more results?
- Use value from meta key array for use in WP_Query
- order by numeric value for meta value
- Set Alias for meta_query arguments in get_posts()
- WP_Comment_Query pagination, delving into the unknown
- Sort posts by category name and title
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Using custom meta_query with relation not working as expected
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- What is an efficient way to query based on post_meta?
- Highlighting Sub topic in a post?
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- how to retrieve specific product attribute value in an sql query?
- Exclude post on loop by multiple meta key value
- WordPress custom archive page
- Retrieve or Query Pages by ID
- Meta query with order by another custom field
- Different string for specifed post type on posts listing at homepage
- Meta query with JSON value
- Get meta info related to current post
- if/else on custom query gives 200 OK when condition not met?
- Creating arguments from loop for WP_Query meta_query
- Get attachment by meta_key value
- Complex WP_Query order request: DESC by day, but then ASC by time
- How to detect if query is runned from widget?
- Using meta_query with multiple keys and compare values
- Is it possible to set specific posts to show first in a query?
- database query with more than a couple meta hangs and doesn’t complete
- Is there a reason why Pages are not publicly_queryable?
- Check return value of get_posts
- Exclude some authors from query
- Get a list of posts by specific category
- How to check the array values, what WP_Query has brought to me?
- How to add custom meta to ‘pre_get_terms’?
- Shortcode for custom query not returning results when attributes are added
- Should I reset $wp_query?
- it’s possible make a WP_Query with math operations?
- Sorting search results with custom dropdown
- Get specific ACF key and value from all posts – no access to DB
- I am officially missing something about transient posts
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- Trouble with serialized metadata
- Problem with my loops
- meta_query compare > not working
- WP_Query about meta_key and its array value
- Create global array to compare inside a query
- Get posts by birthday
- Saving custom fields for WP_Query to retrieve
- WP_Query with MetaQuery issue
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- WP_Query with meta_value_num and meta_query not paged correctly
- Post Query not working after updating to 4.1
- Orderby Meta Value and Query from Meta Query
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- Sort Posts with custom meta key by default which is currently set as optional
- Custom post types loop on a page template
- how to use transient method?
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- WP Query – Show custom posts only if user contain some user meta