Your date format is wrong, MySQL date format is yyyy-mm-dd
. Once you get that fixed, see WP_Query
‘s meta_query
, no need for raw SQL in this case.
Related Posts:
- How to display SQL query that ran in query?
- Custom query_var causes displaying posts archive on front page
- What is the most efficient way of implementing a favorite post system?
- Why does get_the_time(‘F j’) return November 30 for all posts?
- Query by one meta_key and sort by another (possibly NULL value)
- Very slow query
- Query & Sort Comments by custom comment meta
- Count user posts by user ID, Post type and Post status
- is_archive() doesn’t work on public query var archive pages?
- How to count get_users query?
- cron job to auto delete posts of a specific post type older than x days
- Possible to get posts from multiple meta keys/values in a single query?
- Difference between fragment caching and wp_cache
- mysql query paging
- How to display all posts with today’s same month and day only?
- Select User by Joining Multiple Meta Value Results
- How do I find if a page has a template?
- Show featured image as background image from postQuery
- Using $wpdb->update but confused on the WHERE in and SET
- You have an error in your SQL syntax – Help with query
- How to retrieve elements from another table in a SQL query?
- Make one query for adding entries to database
- WordPress Loop: List All Posts by a Category & Subcategory
- Order query by post meta value
- add_query_arg() and empty variables inside
- Query Strings and Woocommerce
- Style Post Differently In Query
- how would I create a custom query to get all users, and a related post based on a postmeta field?
- Display posts with a start OR end date later than current date
- Help with MySQL to $WPDB query
- Order posts by custom field DATE value
- Form redirect with query vars to page
- Query to Get All Users from wp_users With NO matching user_id In wp_usermeta
- WordPress custom setting page – add flashing message
- Custom query AFTER rss fetch_feed not working
- Attempt to improve WP search, can someone check my SQL query?
- WordPress Query orderby title with UTF8 string in title
- Searching With Apostrophe
- Multiple Category Query
- list all categories that have a certain word in title
- Passing parameters to a static front page
- wp_list_pages() refuses to output posts
- List author’s posts with SQL
- Where is the query in wp-login.php
- Can’t seem to do combined query AND sort?
- sort query results by newest
- How to reset usual $query on search page to push custom $wpdb query there?
- get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)
- Order by meta value pro first then meta value free in my search function
- Order by title – but now built in wordpress func, sort the_title
- Display posts between two particular dates
- pre saved posts query from db options table
- $post->ID not working in combination with a custom query
- How to delete all posts, categories and tags from WordPress database
- Ideas how to search & replace post_content when string contains a newline?
- Query the WordPress database to get data together with replaced information
- $wpdb->prepare affecting the query?
- WordPress SQL search, how to handle SQL Injection?
- Query for Custom Post Type UI Does Not Loop All the Post
- Updating with $qpdb->query() always returns 0 rows affected
- wpdb query with dynamic column name?
- How do you display the number of a post in a query?
- How to manage a particular “order by” for get_search_query()?
- Query to view scheduled or draft post
- How can I get the name of term post meta value which equals term id
- Help with Related Posts Function
- Trying to use WP_Query to return post with and without meta values
- How to add a Variable to post query
- Sort a list of a CPT ( job) if a meta is empty
- PHP Fatal error: Uncaught Error: Call to a member function insert() on null
- SQL query to delete users with multiple meta keys and comments
- Restore WordPress Backup Locally?
- Trouble migrating custom post types from non-wordpress cms
- Pagination adds search query (again)
- “order” does not affect order of custom query
- Create a new post on a specified publish date via link?
- Exclude Posts from a Widget
- Fastest and most efficient SQL query to check if UID exists
- New custom post type entries are not sorted correctly in admin using pre_get_posts
- Query String for the WP_QUERY parameters
- Counting And Monitoring How Much Queries My Script Used
- $wpdb query for price in custom field value
- Run an update query in a function
- Multiple terms not working on taxonomy
- Sorting of coupons in the right way
- search.php is not generating the right results
- excludeCat function reverses order of blog posts
- Slow query when joining wp_posts with a lookup-table?
- Run search query again without pagination gives no results?
- Mysql query and odd results
- Using wp_list_table how to trigger update function “inline”?
- Filter multiple different main queries on custom pages
- WP_Query orderby meta key/value suddely stopped working
- WP_Query older new links navigation?
- How to get one result using wpdb class?
- Delete query won’t run
- Where can I find the SQL to get the most used information by wordpress database?
- WooCommerce Total # orders [closed]
- Modify a query using both a text field and a true/false AFC field
- How to show sticky posts on all pages of the pagination, not just the first page?