This should work for you:
$tEA = array(
'post_type' => 'event',
// you dont need meta_key as you use meta_query
//'meta_key' => $metaKey,
'orderby' => 'meta_value',
'order' => $order,
'posts_per_page' => $postPerPage,
'meta_query' => array(
array(
'key' => $metaKey,
// value should be array of (lower, higher) with BETWEEN
'value' => array('START_DATE', 'END_DATE'),
'compare' => 'BETWEEN',
'type' => 'DATE'
),
)
);
Note that START_DATE and END_DATE should be in MySQL date format YYYY-MM-DD
Related Posts:
- Order by multiple meta key and meta value [closed]
- Query posts only with featured image
- Order by optional meta key?
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- WP_Query: query posts by ids from array?
- WP_Query and polylang issue
- Given a WP_Query, how can I get a list of tags?
- JSON: schedule creation of json file
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- WP_Query meta_query by array key
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- wp_query with multiple custom fields
- Removing posts from the returned wp_query. Cannot use object of type WP_Query as array
- So strange result of wp_query and have_posts
- How to detect if a function has been fired on any page so scripts/styles can be loaded conditionally
- Why execute the_post()?
- Count total number of post in foreach loop
- ACF Relationship + WP Template Parts
- $wpdb insert is not work
- WP_Query Ignoring `post_type` parameter
- How to get the WC_Product Object when using a WP_Query in WooCommerce
- get_posts – find out if querystring was crap and fallback is used
- Custom Search Result Page displaying only 1 result.
- How to query a custom post type with a taxonomy filter but display post type archive page?
- How to display 7 most recent days of posts?
- WP_Query Variable inside Array
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- Set Transient does nothing
- Get amount of CPT with a certain custom field value
- The pagination on index.php doesn’t work on a first page
- Include tags in WP_Query
- How do I make a meta_query OR relation work? [closed]
- WordPress multisite – fallback on subsites to main site on 404 and dealing with switch_to_blog function
- Count author posts in certain category
- How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 – 343)
- Taxonomy Query Relation field not behaving correctly?
- Woocommerce – Changing the order of the upsell products [closed]
- How to output topics and replies in bbpress as table?
- twentyeleven_content_nav hook no longer outputs navigation link after 3.5 upgrade
- how to access query string in wordpress?
- Better wordpress attachment query than this
- How to get all post except particular category without breaking the paging
- How do I rewrite this loop as a new WP_Query style-loop?
- Pagination only won’t work in author template
- ACF Query Structure
- Can’t sort custom post type by random
- WP_Query gives me different results depending on the category order
- exclude product with available tag
- WP_Query meta value order is not working
- How to get main menu only with wp_nav_menu
- relation OR instead of AND – Filtered term ID’s in loop
- How to get specific string in explode array?
- using nav menu id’s
- filter posts by meta key with pagination
- Single post – display list of all posts + specific post
- Ajax (jquery) wp_query pagination returns -1
- Modify output of custom loop using WP_query
- What’s wrong with this wpdb query?
- The Events Calendar, wp_query returning event date not published date
- Query to get result by Title or Meta along with tax_query parameter
- Oxygen Repeater Advanced Query
- SQL query injection with fifu image
- How do I use multiple similar queries with WP_Query on the same page?
- WP_Query order by multiple meta keys & fields
- Use dedicated functions
- WPQuery Date and ACF
- Pagination not working on archive.php template?
- Save large WP_Query to transient === false
- 3 posts from each existing category on one page
- How to show specify category template for both parent and child category
- WP_Term_Query->get_terms() very slow query for WordPress filter
- WordPress search page pagination displaying but not functional
- Get all wp_users sort by metakey
- query all posts published by certain user id
- How to create URL parameters to run custom queries?
- How to use wp_query in different column in single loop
- Paginated Post List on Front Page
- Query custom meta value – post view and date meta
- modifying the loop multiple times with arguments passed through ajax to wp_query
- WP_Query – show posts where meta value and user_email match
- WP_Query causing links to not work
- Query Top Set Custom Taxonomy In Given Timeperiod
- Website goes slow down after importing long database
- Orderby Date and Category
- WP_query issue with no posts
- Pagination for custom query throws 404 errors on last pages [duplicate]
- Order posts by custom column using pre_get_posts
- wp_query in form method of widget breaks customizer
- Featured image not showing on page
- Add filter to Orderby Parameter using Array
- Iterate through ID’s in loop
- Need help setting up a search form for wordpress [duplicate]
- Including ‘cat’ => $cat breaks meta_query
- problem in query_vars parameters
- Limit Tags display and ad Drop Down Menu
- Add banner after the third post [closed]
- How to retrieve _embed (etc) fields in get_posts custom query?
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- How to save the results of a query as a php file for an autocomplete search bar