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

4
votes
0answers
128 views

Custom WP_Query order by post_meta and (author) user_meta

I am having an issue that i couldn't find on google and elsewhere. To put problem in the context. I am making a wordpress site where user can put their tutor listing for giving a tutorials, and i am ...
2
votes
0answers
289 views

sort by date in Advanced Custom Field

I am trying to filter posts with certain values and sort by the date field using ACF module. I have succeeded in filter with package and type. But when i added date sort, its not working. Please help ...
1
vote
0answers
16 views

Alter main archive, to show posts with meta as last

I'm having troubles with getting posts with meta_value "sold" as last in the main query of my custom Post type. The best/easiest way i can think of at the moment is to filter the "sold" posts out of ...
1
vote
0answers
46 views

Meta Query posts not showing on ending date of custom field

I feel like my logic is off, but the short version is I have 2 custom fields spitting out unformated times for event-start-date and event-end-date. I don't want to show a post if the start-date is not ...
1
vote
0answers
30 views

meta_query not working as expected

I have 3 posts that each have two meta values. The first meta value is one that they all share (ac_parent_event). The second is one that is unique to that post (ac_thischild_date). For this function, ...
1
vote
0answers
132 views

get posts by meta_key from inside key of post meta

How can i get posts sorted out by meta_key from inner key array of post meta values, for more details please look at my code: // Example output of each post_meta, key is views array( 'all' =>...
1
vote
0answers
36 views

How can I create a WP_Query that returns posts where one meta_value <= another meta_value

I have a working, pretty complex SQL query hand-written in a function. For the sake of leveraging WP_Query optimizations, and simplifying my code for maintainability, I'd like to convert it all to ...
1
vote
0answers
25 views

WP User Query Issues

I am trying to create a search of users to search for them using their first name, last name, billing phone, ID, or email. I have the following code written, but it does not pull in the correct data. ...
1
vote
0answers
157 views

meta_value_num not ordering all items

I am using meta_value_num to output a list of items in order by a custom field. The custom field value that is being passed is 1, 2 ,3 or 4. The order works for the first 7 items but after that they ...
1
vote
0answers
288 views

Slow WP_Query with 'OR' on meta_query

Essentially, I'm trying to query using a filter for the args being fed into WP_Query() like so: public function filter_wp_query( $args, $template_slug ) { $args['post_type'] = '...
1
vote
0answers
154 views

Meta Queries - should nesting work after WP 4.1?

I have a rather huge meta_query here and it hangs at execution: browser just won't load the page, it goes on loading ... As far as I know this should work after WP 4.1 (I have it). Also tried ...
1
vote
0answers
568 views

Compare meta_query with a Regular Expression and do a less-than operation on it

I have the problem that my client is using a theme which stores options of items in a serialized way in the post_meta table. I already found out that this is not the best way to save values ...
1
vote
0answers
169 views

WordPress Filtering Custom Post Type by Metadata and Search Heirachy

I have a custom Post Type called cptMovie which has two Custom Field (Metadata) "Language" and "Box office" assigned to it. I also have a Custom Taxonomy called movieTax with 4 tax Terms "Action", "...
1
vote
0answers
62 views

Configuring a meta query with multiple post types that have the same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback. I have two custom post types called "Clients" and "Projects" and they each pull information from one ...
1
vote
0answers
219 views

Ordering custom post type by multiple custom fields

I was wondering if you'd be able to help with an issue i'm having? I have implemented a fix that you came up with in this post: How to order custom post type by multiple custom fields? however when I ...
1
vote
0answers
60 views

2 weeks ago from meta query meta value

This is my meta query within my posts query. 'meta_query' => array( array( 'key' => 'rw_membership_ends', 'value' => ??????? ...
1
vote
0answers
309 views

WP_Query with meta_query dosen't return results

I am trying to get list of posts filtered by fields I added using the advance custom fields plugin. I have more fields that I want to use but it doesn't work as I want it to. Here is what the query ...
1
vote
0answers
114 views

Possible to filter custom post type with multiple meta data?

I'm wondering if it's possible in one loop to accomplish what I need to do. What I would like is to sort all custom post types by the meta data of county and put them in order which it is doing here. ...
1
vote
0answers
92 views

database query with more than a couple meta hangs and doesn't complete

I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the ...
1
vote
0answers
101 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
146 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
0answers
400 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
0answers
417 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 field....
1
vote
0answers
811 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
672 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, specialty,...
0
votes
0answers
20 views

Very slow query for getting posts with postmeta

I have an heavy query generated by an search page which should get filtered posts based on some meta data. SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( ...
0
votes
0answers
14 views

Fallback meta_key if first has no value?

I'm using the code below to get all items from a particular category that have a date field with a value either equal to today or in the past. The problem is that there are two different date fields – ...
0
votes
0answers
49 views

Order ascending is ignored in meta query?

I'm using pre_get_posts to alter my main query and attach a meta query to it. This is on a woocommerce products archive page (...not sure if that would make a difference). function has_upcoming_date(...
0
votes
0answers
22 views

WP Meta Query at depth 2

I'm interested in doing a meta query according to some post data that doesn't exist at the first level of the post meta. In other words, I would need two or more keys to get to the variable I'm ...
0
votes
0answers
15 views

How to add OR condition in wordpress main seach box Query?

I'm trying to search from main search text box. Custom post type "course" and it custom taxonomy 'Location'. It I search with "USA", In data it looks for 's'= 'USA' AND 'loaction'='USA'. What I ...
0
votes
0answers
31 views

Best way to Order Post in Home without a plugin

We are trying to reorder one section of the home page. our approach was with meta_keys and meta_values WP_Query Sample: <ul id="featuredMain" class="feautrued-main"> <!-- Main ...
0
votes
0answers
31 views

Orderby one meta key, remove posts with another

I am trying to order custom posts with a custom taxonomy with a meta key value. I am also trying to remove posts from that loop if they are past the date set by another meta key. Here's my code: ...
0
votes
0answers
33 views

Is it possible to search for a string in posts OR postmeta?

If I have a text string $search_string and construct a query like this: $args = array( 's' => $searchstring; 'meta_query' = array( array( 'key' => 'my_key', 'value' =&...
0
votes
0answers
18 views

meta_query in $args ignored when called from theme

I have the below function in my plugin in the MyManager class. public static function test() { $numRowLimit = 6; $arrArgs = array( 'posts_per_page' => $numRowLimit, '...
0
votes
0answers
33 views

Show list users based on two custom field values

I'm kinda stuc. I have added an extra field in the user profile for my authors, called ArtistCategory which can be Tattoo or Piercing. I'm using this key and value to filter for menu and gallery ...
0
votes
0answers
113 views

WP_Query meta query not returning results as expected

I'm trying to run a get_posts query to determine if a users ID is either set as a meta key value or is included within the array of another meta key for an event on a given date. I am passing $status,...
0
votes
0answers
48 views

Meta Box Plugin - Adding field value inside echo

I am using Meta Box Plugin to add some custom options to my Page Edit. I added a field to add an image background to the header which is working great. This image background has a parallax background ...
0
votes
0answers
46 views

WP_Query with meta_query returns where zero expected

I'm using a WP_Query with a meta_query key to get results from a custom post type using the following code: $args = array( 'post_type' => 'werknemers', 'meta_query' => array( ...
0
votes
0answers
24 views

meta_query against multiple custom fields

I have a set of ACF custom fields: event_type (values are "single" or "multiple") event_start_date event_end_date (this only shows up if event_type is set to "multiple") I need to be able to show ...
0
votes
0answers
156 views

Help optimizing slow WP_Query with meta_query

I'm trying to create a custom WP_Query. Right now, I have two meta fields, roi_min and roi_max. The ideia is to get posts that has a roi_min greater than the selected value, and a roi_max lower than ...
0
votes
0answers
43 views

Show posts in numeric price order using meta query combining 2 meta keys

I've built a custom estate agency website for a client but I'm stuck on this one last thing before it's good to launch. I'm using custom meta fields to allow for additional meta data such as Price, ...
0
votes
0answers
80 views

Custom Table for custom post type meta data

I'm looking to store the meta data for a post type in a uniquely named table. You see I have a site with a large amount of custom post types with a large a mount of custom fields. I want to clone ...
0
votes
0answers
59 views

WP_Query using meta_query with LIKE doesn't return what it should

I am using this code to get stuff based on my custom field and custom content type. $searchTerm = 'bestafricanvideos'; $args = array( 'post_type' => 'sitemaps', 'posts_per_page' => -1, ...
0
votes
0answers
35 views

Query and compare multiple meta values

The problem: I have a custom post type of 'events' which has two metaboxes: cf_eventdate and cf_eventend. The first contains the event date, in the format: 2015-11-05. The second contains the end ...
0
votes
0answers
38 views

WP_User_Query from meta_key and orderby secondary meta_key

I have this code, which works as intended, but now I want to order these by another meta_key. I've tried using meta_query to get another key into the mix, but am still unsuccessful. I want to get all ...
0
votes
0answers
41 views

Run query with meta key via AJAX

I'm completely new to AJAX, and I can't seem to find anything that's pointing me in the right direction. I have a table that contains one row for each post in a post type. Each row contains the posts ...
0
votes
0answers
142 views

Meta query in serialized array

I have a meta query made, but some of the meta fields I use are stored in serialized arrays(based on the documentation of the plugin I used to create them). What is the right way for me to make the ...
0
votes
0answers
93 views

Used with meta_query in query_posts works slowly

Hey i have a problem this my code and if i used with all parameters i get from $_GET its start work so slowly..... (like 5 min). $checkbox = array( 'immediate'=>'כניסה מידית', 'air'=>'...
0
votes
0answers
21 views

How to sort by meta value, then by other meta value

I've been tasked with creating a 'fully automated' agenda for my client. The goal here is to create an agenda for a conference. The idea is that one shortcode will automatically populate the entire ...
0
votes
0answers
91 views

How to get meta value based on latest post id with group by term name

my query is SELECT terms.name as artist_name, wposts.ID,wpostmeta1.meta_value as image FROM wp_posts wposts LEFT JOIN wp_postmeta wpostmeta1 ON wposts.ID = wpostmeta1.post_id and wpostmeta1....