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.

learn more… | top users | synonyms

1
vote
2answers
341 views

How do I find if a page has a template?

So I'm doing a query like this: $the_query = new WP_Query( array( 'meta_key' => 'homepage', 'meta_value' => 'yes', 'post_type' => 'page', 'orderby' => 'modified', 'posts_per_page' ...
2
votes
1answer
736 views

How can I query all users who registered today?

I'm trying to use meta_query to return all users that have registered today : $args = array( 'meta_query' => array( array( 'key' => 'user_registered', ...
0
votes
2answers
2k views

Use have_posts() with array of post results retrieved by $wpdb->get_results

I don't know if I'm retarded, crazy or just plain genius or not, but I've decided to use tags as a way to link content site-wide (a big ol' many-to-many relationship website for archiving various ...
0
votes
1answer
387 views

WP_Query orderby meta key/value suddely stopped working

I have code that has been working for a long time which when a user clicks a button to order database results by name/value, it gets the results via AJAX from a page that does all the querying. I ...
0
votes
1answer
700 views

Displaying posts with only upcoming dates according their custom field date value

I got posts that have starting date as a custom field value. I'm displaying few of those posts in my sidebar in ascending order so that the post with closest starting date is shown first. This is what ...
1
vote
1answer
445 views

WP_Query filter and order by meta ordering by wrong joined table

I'm trying to both filter and order a Wordpress query using the meta_value, however the ORDER BY part of the query seems to be working on the wrong table. The query params here are: array(12) { ...
2
votes
1answer
470 views

Meta_query with relation 'OR' killing server CPU

function get_nb_offres( $typeOffre ) { global $type_bien_correspondances; $args = array( 'post_type' => 'annonces', 'meta_query' => array( 'relation' => ...
0
votes
1answer
958 views

filter custom post type by meta key in dashboard

I'm looking for a way to expand e customize more this topic how to filter post listing (in WP dashboard posts listing) using a custom field (search functionnality)? I've a custom post type in the ...
0
votes
1answer
408 views

Compare meta_query decimals not working right

I have a custom field named 'rating' that holds decimals from 1.0 to 10. I am trying use wp_query to get me all the posts with a rating of 8.0 to 10. What I have so far almost works perfectly but it ...
1
vote
1answer
2k views

How to grab metabox value in wp_query meta_query key

How would I modify my WP_Query in order to get a custom meta box value instead of a custom field one like I currently do? This is how my query looks like: <?php $today = ...
0
votes
1answer
430 views

How can I do a variable for meta_query?

I have a code which needs a variable compare string array( 'key' => 'rob_value', 'value' => $rob, 'compare' => '=' ) the compare =>'=' needs to be ...
1
vote
1answer
2k views

Plugin that would allow WordPress Authors to “follow” other Authors and query “Activity Info” from that

I have a WordPress blog that is all user based Authors that submit content and such. Currently in the site, you can view other authors profiles but basically just view their content from the ...
0
votes
2answers
118 views

Getting a custom post's custom field based on another custom post's custom field select

So I'm at my wit's end here. I've done this before plenty of times, but I think I have stared at this so much I am missing something. I basically have a custom post called locations. That custom ...
0
votes
2answers
391 views

Create an archive listing based on meta array

I've got an "event" custom post type, with a meta field is used for the event date. I've successfully created archive pages (year and month) based on the answer on a previous question (here). Now, I'm ...
2
votes
2answers
1k views

Archives for custom post type based on a “date” meta value

I've got an "Event" custom post type. Each post has a meta field for the actual event date, which cannot be the posts's publish date, as most all the event dates will be in the future. With that, I'm ...
0
votes
1answer
858 views

Difference between 'LIKE' and 'IN' in meta queries

You can use a variety of different comparison operators in meta queries, among which are 'LIKE', 'NOT LIKE', 'IN', and 'NOT IN'. What is the difference in use between LIKE and IN? Here's the ...
0
votes
1answer
496 views

meta_query displays all results and none, my query is wrong

I´ve read almost this articles but unfortunately my query is no working, I think i´m very close but could be so far away. I´m trying to get metadata using a custom form with method get, $rob = ...
0
votes
1answer
473 views

Arrange Posts By Date In Order Of Closest To The Current Date

I have a list of events on a clients website that show in a sidebar. When viewing the homepage you see one event and if you're anywhere else on the site you see two events in the sidebar. I am ...
-2
votes
1answer
531 views

Too many if's and else if's ?? - Must be better way [closed]

Everyone on this forum has helped me tremendously. Thank you. I now have a page that functions the way I want it but my code seems to be cumbersome. To figure out a string to echo I have a long ...
-1
votes
1answer
105 views

294 Queries on Mainpage of Wordpress

I have 294 queries on my wordpress site. I checked using sql monitorand the maximum queries are to display count of a cities list custom field. Lets say there are 200 cities then 200 queries are ...
0
votes
2answers
54 views

Should I save this mulit dementional arary as one post meta?

I have several blocks of data to save into post meta, including 'file_property', 'workspace_property', 'user_property','access_type', 'usage_tracking'. Each block in itself is an array. Should I save ...
1
vote
1answer
536 views

Filtering by Post Meta Custom Fields - Performance

I could use some advise on how to structure my data for performance. I have a custom post type with a lot of custom meta data stored in the wp_postmeta table as a serialized array under one meta key ...
3
votes
1answer
3k views

Meta Query with AND & OR?

I'm trying to do some filtering for some posts in WP_Query, but I can't seem to get the right condition. Basically what I wanna do, is get posts that have the custom field event_data (sorted by this ...
0
votes
2answers
713 views

Custom query looking at multiple custom fields and properly sorting

For the past two weeks I've been looking for a way to create a query in wordpress that returns all custom post types where a meta_key "mytype-expired" is NOT set to "yes" and then order the results by ...
1
vote
2answers
635 views

Nested Queries using meta_query

I'm trying to build a query that lists posts of a custom type with specific custom field values. Then I need to list children of each of those posts within the post, and those children also need to be ...
0
votes
1answer
2k views

Filter Loop by Custom Field Value

I'm trying to filter a loop by a custom field value. I've tried all of the suggestions on the site, but it just won't filter. This loop is being used for a custom template of an rss feed. It pulls ...
3
votes
1answer
2k views

Querying custom post type with 2 custom fields (date-range)

I've searched WP Codex and StackExchange and gotten some clues, but I can't get this query working. I have 2 custom fields associated with each exhibition in Y-m-d format: exstart-date being the start ...
1
vote
0answers
784 views

$wpdb class updating meta_value using Ajax [closed]

I am trying to create a way to change the order of posts using a meta_key / meta_value that is updated using jQuery ui-sortable. I'm already using menu_order in the same way but need to create a way ...
1
vote
2answers
977 views

meta_query, number comparison, not quite working as it should

I have a wp_query that gets all custom post types in ascending order from today, to list some events on a site of mine. While this works fine: $args = array( 'post_type' => 'events', ...
1
vote
1answer
351 views

Pull a post based on a meta value in a custom post type

I'm trying to display a post, from a custom post type based on a meta value in that post type, in this case a checkbox that says "if this is checked show it on the front page. Usually I write a ...
0
votes
1answer
501 views

WP_Query not returning correct result with meta_query parameter

I've got the following loop on my index.php template: <div id="new_on"> <?php $args = array( 'meta_query' => array( ...
0
votes
1answer
212 views

Querying multiple values from a single key

Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the same key the ...
0
votes
1answer
343 views

How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?

My goal is to return posts based on a specific price range using meta_query. The price in the admin that the user enters is a custom field, created using WPAlchemy. In the example below, the query ...
1
vote
1answer
1k views

I can't set meta_key in my custom post type query

I've created a custom post, events, and saved the meta data event_year to each event. I'm trying to get a year's event archive. When I go the the following URL, the meta_key and meta_value are not ...
3
votes
1answer
2k views

WP_Query with checkbox meta_query

I have posted this on StackOverflow too, not sure if that's allowed - if not let me know and I'll remove one (I don't want to look like I'm spamming). Anyway.... I have a custom post type and have ...
5
votes
1answer
778 views

how to show posts that are missing a meta_value

How can I build a query to find posts that DO NOT contain a certain meta key or meta value? for example: query_posts( array( 'meta_query' => array( array( 'key' => 'feature', ...
5
votes
1answer
5k 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 ...
0
votes
1answer
687 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' ...
1
vote
1answer
158 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
189 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
2k 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 ...
1
vote
3answers
633 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 ...