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
1answer
140 views

Change order of posts

I made a post recently that did not explained myself right! Come again, but with better explanations. I need the "Select Option" change the order of query_posts. My current code is: <select> ...
1
vote
0answers
82 views

Meta Query And/Or

My question is very similar to Meta Query with AND & OR? . This question was answered in 2011 by @Otto. With the exception that my logic is different. I want to query, for example, posts with ...
1
vote
0answers
111 views

Pre Get Posts / Multiple Meta Keys / Orderby Single Key

Tried more than a few variances to enable my pre_get_posts callback function to display posts that possess one, or both, of 2 separate meta_keys, upon display to then orderby a single meta_key. Here ...
1
vote
1answer
171 views

query order by date on custom type: wrong order

I know there are very similar questions ans answers out there already, but I simply cannot get my query to get into the right order. I have a custom post type ("bb_articles") with custom fields, ...
1
vote
1answer
126 views

Filter posts by meta query?

I made custom post type and used a meta query … For this link: ...
1
vote
0answers
295 views

How to filter a query by multiple meta keys and order by other meta keys

I'm trying to query posts using WP_Query and meta_query parameters: $args = array( 'post_type' => 'produkty', 'meta_query' => array( 'relation' => 'AND', array( ...
1
vote
1answer
841 views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
1
vote
1answer
367 views

Use meta_query to get title of associated post

I have two post types that I've associated in one direction by assigning Post A as a custom meta field of Post B. I need to search based on the titles of Post A and return the associated Post B ...
1
vote
0answers
333 views

Meta query with multiple custom fields for archives page ordering problem

I'm modifying the query for archives pages so that the posts showing up on year, month or day pages are queried by there custom field (start-date and end-date) and are sorted by custom star-date ...
1
vote
0answers
432 views

filter custom field values $min $max

The user needs to query posts by entering a $minPrice, $maxPrice and a category value. Here is my query which returns no results: function result() { $result = array( 'cat' => ...
1
vote
0answers
444 views

filter search custom field query

I'm looking for way to filter search results. This is what I have so far a custom post type of "doctors" in each "doctor" post, there are numerous custom fields (male or female, location, ...
1
vote
1answer
45 views

How to let users choose where to search for posts?

I have no code to let you correct/see, I'm still in 'thinking stage'. What i would like to achieve is this: A real estate website with a few search functionalities. This new agency (REALLY NEW we have ...
1
vote
2answers
2k views

Passing form inputs into multi-taxonomy query

I'm in the process of building out a search page to perform a query on a custom post type and its associated meta and taxonomy. Eventually, I would it to query multiple taxonomies as well as compare ...
1
vote
0answers
735 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
96 views

Help on multiple meta_query

I am trying to fetch from the WP database posts with two meta_key values, but the result is 0 posts. Print out of the arguments: Array ( [taxonomy] => cardstax [term] => christmas ...
0
votes
3answers
416 views

Undefined property: WP_Query::$post

I am working on some rather elaborate comparisons between metadata and having a bit of trouble correctly referring to results from my query. The first query to establish $team_is_home works fine but ...
0
votes
2answers
918 views

pre_get_posts and set

I have some functions into my pre_get_posts filter. So, the problem is that when I set a meta_query, all the menus disappear from the page. function propersearchfilter($query) { $taxarray = ...
0
votes
1answer
63 views

Advanced Search by minimum/maximum values

I'm building an advanced search form which allows me to search by different parameters. Currently, searching by taxonomies work fine. My issue occurs with trying to set a minimum price to search by. ...
0
votes
1answer
833 views

How to query wp_postmeta table for any specific meta_value?

I am using following code in the theme files to get some output from the DB: <?php $querystr = "SELECT DISTINCT meta_value FROM $wpdb->wp_postmeta WHERE 'meta_key' LIKE 'movie_name' ORDER BY ...
0
votes
1answer
261 views

Get a single post ID based on an exact match of 1 or more meta values

I'd like to find the post ID based on an exact match of meta values (could be more than 1). All the examples I have found show find the post ID from 1 meta value. In my example I'd like to pass in an ...
0
votes
3answers
2k views

LIKE %…% Meta Query

I have a serialized array as a meta value and I'm trying to run WP Query where it finds a specific value in the serialized array. Here's an example of the serialized array field: ...
0
votes
1answer
2k views

How can I create a meta_query with an array as meta_field?

Here are the args for my query : $args = array( 'post_type' => 'news', 'meta_query' => array( array( 'key' => 'topics', 'value' => 'sports', ...
0
votes
3answers
160 views

Delist entries in the_loop

I am trying to add a delisting feature to my WordPress network. Posts which are delisted would not appear in post lists, but would still be visible if accessed directly. I've written a plugin that ...
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 ...
0
votes
1answer
382 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 ...
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 ...
0
votes
2answers
72 views

WordPress Screwing Up 'orderby' => 'meta_value_num' in 'pre_get_posts'

I have a bunch of _ai_price_int meta values set up as just numbers. This is how the table looks: meta_id, post_id, meta_key, meta_value 1309, 1111, _ai_price_int, 6550 1310, 1115, ...
0
votes
1answer
43 views

meta_compare not comparing whole integer

I have submitted an integer data via a form to my custom search page. I can get values properly if the input is single char (e.g. 1 ) but if the input is multi char (e.g. 100) it still compares ...
0
votes
2answers
40 views

I would like to have add_post_meta to return the ID instead of true or false

I would like to know if there's a way to have the ID when we use the add_post_meta() function ? I need it so I could remove it using ajax calls. Is there a way to retrieve it or I'll have to make a ...
0
votes
2answers
46 views

Is it possible to load a different sidebar in single.php based on a meta_query filter?

I have a custom post type 'speakers' and I have a checkbox custom field (meta_query) to separate my Conference speakers from my Workshop speakers. I can filter my speakers with this meta_query and ...
0
votes
2answers
44 views

WP Query - Is this correct?

Trying to debug, getting headache so I want to ensure that I have placed the query args in the correct place. I want to sort/order all my posts based on "myvalue". <?php if ( ...
0
votes
1answer
29 views

Order by meta value

I've a custom post type that has a custom filed called deck-number and client wants to sort the result by deck number. FYI, deck numbers are numeric values. So I used query like bellow. ...
0
votes
1answer
322 views

Check for the existence of custom field

I am using the Advanced Custom Fields plugin, and I want to do a query to show all posts where a "date" field is before today and where another custom field (a report) has a value. For now I have ...
0
votes
2answers
121 views

comment meta_query for keys that aren't yet set

I need query help! I am trying to set up a meta_query (for get_comments) for keys that aren't yet set. I have some code that allows moderators to add a custom meta key to individual comments. Click ...
0
votes
1answer
947 views

exclude custom post type by meta key in wp_query

I'm trying to display a custom post type (properties) and exclude posts that have a certain meta value (sold). Is there a way that I can do this? I have this for my code so far: ...
0
votes
1answer
97 views

Ordering a mysql style datetime stamp with meta_query

I have a custom post type field that I am storing data in called football_game_datetime. Example format and values for this field are examples like: "2013-10-31 14:00:00", "2013-09-16 20:00:00", ...
0
votes
2answers
348 views

Event with multiple dates, display events chronologically

I've been breaking my head over this for days now and can't seem to figure it out (with the limited knowledge I have). I want to achieve the following: I have a custom post type 'Events'. Each event ...
0
votes
1answer
132 views

Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

I have a post type that holds a custom meta field with a date in it. The date is stored in the format: yyyymmdd. On the archive page for this post type I want to create 12 separate containers, one ...
0
votes
1answer
336 views

Query posts by Author and/or by Tag

I'm pretty sure I need to do some sort of custom query, but not sure about the best way to go with it. I have an author page. It needs to display that author's posts. That's fine, I can do that. I ...
0
votes
1answer
780 views

Filtering a WP_Query meta_query by numeric values isn't working

That was a very dense title. I have a custom post type "event" which has a Date/Time picker field "event_date" thanks to the Advanced Custom Fields plugin. This Date/Time picker saves a UNIX ...
0
votes
1answer
278 views

Meta query - How to display a null meta key

At the base I have this query wich displays 9 randoms custom post type : $args= array( 'post_type' => 'adverts', 'orderby' => 'rand', 'posts_per_page' => 9, 'tax_query' => ...
0
votes
1answer
719 views

How to query posts with featured images

I basically want to use WP_Query to select 3 latest posts which have featured images and this is the only way I can think of. regards edit tried $query = new WP_Query( array( "post_type" => ...
0
votes
2answers
637 views

How to query posts based on lat-lng coordinate as post meta?

I'm planning a custom WordPress theme where the Custom Post Type (CPT) will have latitude and longitude coordinate as it's meta value. The latitude and longitude will be displayed as a Marker in a ...
0
votes
1answer
590 views

Meta query with timestamp using WP_query

I'm having a problem with an events system that I'm developing for a local roller derby leaugue. I have made a custom post type ('event') where a user can add a few different types of events ...
0
votes
1answer
588 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 ...
0
votes
2answers
115 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
357 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 ...
0
votes
1answer
776 views

Search by meta_query

I am building a Wordpress site with an events feature. The events page was made with custom post types. I want to make it possible for people to search/ filter events by dates. For example, they can ...
0
votes
1answer
210 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
2answers
636 views

meta queries do 'either/or' checks

I have a meta_query like this , but 'relation' => 'OR' NOT WORKING, Does meta_query only do 'both/and' checks and don't do 'either/or' ? $args = array( 'post_type' => 'post', 'posts_per_page' ...