There is one issue I see in your code. Within ‘meta_query’ you cannot use ‘meta_key’, but it should be ‘key’. For example:
array(
'key' => '_reservation_date_hour',
'value' => $GMT_checkHour,//the value it is grab using ajax form
'compare' => '>=',
'type' => 'DATETIME',
)
So with your previous code all ‘meta_key’ lines were ignored. To identify such problems, I also suggest using this code:
$query = new WP_Query($args);
var_dump($query->request);
exit;
to check what WordPress makes from your arguments. This will show you the actual SQL query, which can often help to see what’s missing or what would you want to change.
Related Posts:
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Using meta_query, how can i filter by a custom field and order by another one?
- meta_query for keys that aren’t yet set
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- wordpress plugin error handling
- Querying custom post type with 2 custom fields (date-range)
- How Can I save multiple records in same meta key?
- order by meta_value serialized array
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Combine tax_query and meta_query in WP_Query
- WP Query group/order by category name
- Using posts and postmeta table to store custom Address Book Plugin data
- How loop through posts based on custom fields
- how to set default value for checkbox in wordpress
- Display custom post types with custom date field value (before today) & order by custom date field
- How to have the right design for a custom post type without accessing themes
- handling csv data with a custom post type
- Customize permalink when creating a post
- Filtering by Post Meta Custom Fields – Performance
- Custom Post Type Navigation on Custom Field
- meta_query compare >= not working but
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Give a permalink to Custom Post Types without title
- Orderby CPT custom fields not working
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- How to use TinyMCE Editor for one of my custom post meta field?
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- Possible to filter custom post type with multiple meta data?
- custom comments form for custom post type
- filter search custom field query
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- Custom fields for custom post type
- Custom post type’s extra fields – how to handle?
- Send a conditional email notification when a custom field value changes in Post Type
- ACF in wordpress
- Getting a custom post’s custom field based on another custom post’s custom field select
- Custom Query: If One Post Object Field Value Is The Same As Another
- Custom post type in Custom widget – $listItem
- Generating and downloading files with WP API
- How to import database table as custom post type and custom fields?
- Fill custom fields when saving custom post types
- Writing a custom Glossary plugin
- Mandatory field in Custom post
- order the meta query results by 2 custom fields
- How to store the third party script with HTML code in the wordpress custom input field?
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- Using OR relation in meta_query to check for a value before sorting by another
- How to upload an image to a custom post type
- Meta query and compare “!=” not working as expected
- Orderby if between two meta fields
- How to select meta key in custom database query
- Show posts from WP Custom Post Type selected from a field in a metabox
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Show Post columns to specific users on condition
- Custom post types – meta_query: search lesson which starts sooner
- Sql Update CPT from publish to draft and particular custom field
- Error when moving custom post type to bin
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Run query on specific admin options page and send results to select field in another function
- Meta_query by date for Events archive
- Custom post type that lets users create a set of posts?
- Populate custom post type/custom fields from an external database
- Error in WP Query. If variable is empty it is displaying previous post value
- Query events post type after current date and timezone
- Selecting posts older than the current Unix epoch timestamp
- Unable to get the upcoming events for custom post
- Filtering problem
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- loop through custom post-type with two meta_keys
- Querying meta values within an array
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Get Posts ordered by a date custom meta field
- Check for custom field value in different post type than current one and do something
- Function to Compare CPT Post Custom Value with Default Posts CF Value
- How to consume external API from WordPress post editor and display the response data in the custom field?
- WP_Query not using relation key as expected and not producing any results
- Meta query with ACF relationship field
- Search multiple custom fields by using meta_query
- How do I Make a custom post type get a custom post template in a plugin
- Automatically Insert Custom Field on Custom Post Type Publish
- WordPress custom meta field for custom post not storing data
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
- List all images from a single post meta value
- Random image from tag/custom type on sidebar
- Using custom field content as expression in IF statement [closed]
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Category display using conditions