Refers to a mechanism built into the WP_Query class for querying the database for post data, including pages and CPTs, based upon post meta data.
4
votes
1answer
2k views
Using meta_query, how can i filter by a custom field and order by another one?
With the following code (in functions.php) my posts (of CPT event) are ordered by _end_date instead of _start_date. What's the proper solution to this as of WP 3.1.3? Of course I'd like to avoid using ...
1
vote
1answer
1k views
How to create a wp_query that contains both meta_query and tax_query
I have a wp_query that works great but I can't have both a meta query and a tax_query in it.
<?php
$event_query = new WP_Query(
array(
'post_type' => 'event', // ...
0
votes
1answer
604 views
What's missing in this wp_query and meta_query
There is something missing because this is driving me crazy at the moment.
I'm using the wp_query with the following args.
$args = array(
'post_type' => 'project',
'post_status' ...
3
votes
3answers
2k views
Fail to compare dates in meta_query
This is the piece of code I use to get event posts whom date metadata is newer than today :
<?php
query_posts( array(
'post_type' => 'concerts',
'meta_key' => ...
1
vote
1answer
112 views
Custom query with DECIMAL(5,2)
I want to know if there is a way to DECIMAL (5,2) instead of DECIMAL in meta_query
0
votes
1answer
163 views
How to “orderby” the first array in a meta_query that uses multiply keys?
My query is currently sorting by end date. How can I make it so it will sort by the start date?
$args = array ('post_type' => 'events',
'meta_query' => array(
...
1
vote
1answer
1k views
WP 3.1 meta_query for multiple custom field values
I'm trying to use some conditional logic to compare custom fields in my query, but a bit stuck. How would I get all posts with ReleasedProject AND PermanentArtist set to 'true'?
Here's what I have so ...
9
votes
5answers
4k views
meta_query with meta values as serialize arrays
I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in ...
1
vote
3answers
545 views
Get Posts shortcode plugin and meta_query?
I'm using Get Posts plugin to list posts with post type "project". I want to filter the list by two custom fields: year (ex. 2006) and state (ex. Completed). I added meta_query to the plugin's ...