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

0
votes
0answers
7 views

Use REGEXP in WP_Query meta_query key

I know I can use REGEXP in WP_Query like this: $query = new WP_Query(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( ...
2
votes
0answers
20 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
1answer
30 views

WP User Query with search columns and meta query

I'm trying to build a query with WP User Query where it's possible to search after user_email user_nicename first_name last_name This are my args: $args = array( 'role' ...
0
votes
3answers
83 views

Order By Multiple Meta Fields

I have two custom fields: meta_key1 is boolean (0 or 1). meta_key2 is a date value - 20150623 for example. Not all meta_key2 fields have an explicit value. It looks like their being treated as an ...
0
votes
2answers
28 views

Orderby doesn't work like expected on custom query

I have this custom query: query_posts( array ( 'orderby' => 'rr_recommends_count', 'meta_key' => 'rr_recommends_count', 'order' => 'DESC', ) ); Which orders the posts ...
0
votes
0answers
17 views

ACF Data Modelling issue?

I'm either missing something or there seems to me like a problem that ACF stores its relational fields as serialzied arrays. Example: I have two custom post types: Game Bonus A bonus is related ...
0
votes
1answer
21 views

Custom loop - Isolating post meta output depending on current query taxonomy terms

I have started constructing is a page to display a series of products based on certain criteria. Each product is part of two separate taxonomies, one for brand and one for product size (each product ...
1
vote
1answer
16 views

How can I apply a meta query for a single custom post type in the main query?

I have custom post type called event, which has custom fields for start_date and end_date. For the event archive, I'm filtering out "expired" events using the following meta query added to the main ...
0
votes
0answers
13 views

WP Query - Group by relation (custom post type)

I have a custom post type Office. An office has an address, email, ... . An office also has a relation with a custom post type Region. So an Office must have a relation with a relation with one ...
0
votes
1answer
29 views

Query Custom post type with Taxonomy Custom Field

I have a Taxonomy called Cities. I have created a custom field for this taxonomy, using ACF, called Country So I can create a City and select the Country (select list with predefined options) it ...
0
votes
1answer
22 views

Querying by taxonomy vs Querying by Custom fields Speed Comparison

I'm developing a listing portfolio for our project. (Basicaly yachts with their type, size, price, cabins, draft, build year, refit year etc.) I should filter them according to type and sort by ...
1
vote
1answer
85 views

advanced search forms with 3 input text and that the main problem 3 input text

N.B. : all my work is on wordpress. I was working for an advanced form with 3 input text in purpose to show a list of hotels. The problem is i tried an infinity tricks and functions but without any ...
0
votes
3answers
48 views

loop query exclude meta_key with meta_value

Hi I use a loop like this: // show all active coupons for this store and setup pagination $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts( array( 'post_type' => ...
0
votes
2answers
24 views

Compare meta key separation

I have a meta key called $availability that can have one of four options but also multiple values separated by pipe: |. For example the value could be: severaltimes_week|oncetwice_month|occasionally. ...
1
vote
0answers
50 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'] = ...
0
votes
0answers
25 views

Modifying default search by including the users additionally

I'm taking products from a CPT with a custom field company defining Users from User Role 'company'. So, products that are filled with that particular custom field, are connected with the user account ...
0
votes
0answers
26 views

How to orderby my custom post type with two custom meta keys

I am working on real state property website. I have CPT "soto_property". I also have two custom fields for this CPT named "price" and "dorm_room". I have a search form, from where visitor can filter ...
1
vote
0answers
45 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 ...
0
votes
1answer
25 views

meta_query date and time comparisons

I am trying to query my posts against the value of 2 custom meta_keys... '_mdjm_event_date' formatted as Y-M-D (2015-05-13) '_mdjm_event_finish' formatted as H:i:s (23:35:00) Here is my query... ...
2
votes
0answers
63 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 ...
4
votes
2answers
110 views

Query Multiple Post types each with own meta query

I have 2 post types: lets say products and product_variations. I'd like to be able to modify the query via pre_get_posts to get all product with meta_keys "_visible" = "true" and "_available" = "true" ...
0
votes
0answers
36 views

Meta query compare timestamp if exists

I have a custom post type with a start and end date timestamp. These fields are not required so they may not exist. What I want to do is query and show all posts that don't have the end date set or ...
0
votes
1answer
31 views

Searching for meta_key returns 0 posts

I am currently on a client project and I am stuck with the meta_key search in WP_Query. I am querying some other parts of the homepage successfully with the WP_Query class, but when I am passing ...
0
votes
0answers
26 views

Multiple Meta_Query using an array to search

I've got the following code from a previous developer which searches through a meta_key called new_location to match a location ID to a meta_value. It works fine for up to 3 different locations at ...
0
votes
1answer
46 views

What format does the meta_query TIME type require?

As per title - what format does the TIME type in a meta_query require? I have a couple of custom fields, date and time - the aim is to show posts dated today and in the future up to the hour before ...
0
votes
2answers
84 views

get_post_meta as a list for drop down search filter

I was wondering if someone could help me out. I would like to create a dropdown search filter for my wordpress site. I would like the drop downs to be populated by meta_boxes values which i have for a ...
0
votes
2answers
104 views

Ignore sticky posts if post is not in meta query

I have such a wp query args: $args = array( 'post_type'=> 'myposttype', 'posts_per_page' => 10, 'meta_query' => array( 'relation' => 'AND', array('key' => ...
0
votes
0answers
31 views

How to use meta query for greater than value in array?

I have saved some price values of three products in a custom field name roomprice. Meta keys and values are like here: **product first** post_id = 1432 meta_key = roomprice meta_value = ...
0
votes
1answer
128 views

WP JSON API meta_query not working

In the code example below I'm using the the post title (name) as the field to store the email address while the password is in a custom field. The following query will pull the correct user but it ...
0
votes
0answers
22 views

how to insert post in wordpress with meta

How can I get the data from a table into the wordpress posts? I use this code but not corectly works... if (isset($_GET['SQL'])){ global $wpdb; $num; $rows = $wpdb->get_results("SELECT * from ...
1
vote
1answer
46 views

Sanitize Custom Field Value in Meta Query

I'm using the pre_get_posts hook with meta_query args to filter an archive loop by dates. Basically, there is a custom post type of "events", and my users type in a date as a custom field for the ...
1
vote
1answer
168 views

meta_query 'compare' => 'IN' not working

First of all, I know it's a duplicate. But, I could find those older answers helpful. I'm searching in posts through post_meta. Here's My Code: $args = array( 'numberposts' => -1, ...
0
votes
0answers
26 views

WP search in metadata post

In want to search by meta data value in post but I didn't succes. For example if I type "sound" I want to found "sounddiary" for example. Here my code: function custom_search_query( $query ) { ...
0
votes
1answer
159 views

WordPress meta_query not working

I am having issues with a meta query on a custom post type. The following arguments are set: $args = array( 'post_type' => 'wp_comp_entries', 'posts_per_page' => -1, ...
0
votes
0answers
21 views

meta query always fails even if data is correct

I've following query - $query = array( 'post_type' => 'accessory', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'accessory-bike', ...
0
votes
1answer
108 views

How to delete only user meta value (not key) from usermeta table in wordpress?

I store multiple image in media library and save its id in wp_usermeta table. my metakey is 'images' and meta value in like '279,280,281'. Now I get the image from table like this: <?php $images = ...
0
votes
2answers
36 views

Wordpress altering my custom query, How to fix it?

I am querying for most popular posts by custom view count by using the custom query below, <?php $mostpopular_args=array( 'post_type' => 'post', 'orderby' ...
0
votes
1answer
34 views

Getting attachments by meta value

I'm stuck at a very simple point: I need to get all attachments by a custom meta key (and value). I'm developing a short code, so it has to work on every possible page. What I've tried so far: $args ...
0
votes
2answers
140 views

WP_Query with multiple meta fields filter?

I have the following query but it is still returning results which include posts which have a meta value of 'deal'. Any Clues on what am i missing in this $args = array( 'post_type' => ...
0
votes
1answer
33 views

Calling Specific Pages with wp query Part II

I'm making one page website and I added a custom field on "Page" post type that asks "Use this page as a section:" Yes or No(with dropdown). I called all pages on template-onepage.php(custom template) ...
0
votes
0answers
15 views

Querying sanatized data with meta_query in Wordpress

I asked this question over at SO yesterday, but I see now that this is the right place for it to live. After Googeling this for a while, I've found that this should work cite, but I don't seem to get ...
4
votes
2answers
223 views

Execute a large WP_Query with many “AND” Meta_Queries?

I have a custom post type product. Visitors can search products with many filters. They can set the color, the size, the price, etc. The details of the product are stored with Advanced Custom Fields ...
0
votes
2answers
126 views

wp_query check if integer exists in custom field's array

I'm using a wp_query to find custom posts that have a specified numeric value inside of a custom field. That custom field's value is an array of numbers (IDs of selected posts using Advanced Custom ...
0
votes
0answers
61 views

Build a query in wordpress , showing Post with Meta

wanted to build query to fetch, meta with Sticky = true. I have used , WCK plugin, https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/ and created , "thumb" and "sticky" ...
1
vote
1answer
80 views

Get attachment by meta_key value

I need to get the attachment (will be only one per post) associated to a post with meta_key wpcf-legislacion-gratis (not matter the value the column has) by using a custom query using get_posts() ...
0
votes
0answers
27 views

Use more than one post meta inside the loop

I have custom meta like this: I want to select the post with both of these conditions are true for : 1- end_date = "some date" 2- st_date = "some date" Also I need it to select by title ...
0
votes
0answers
28 views

meta_query argument not working

I am trying to use WP_Query to search through posts BUT I want to also search by post_title as well, which is why I tried using meta_query in my arguments array. I want to actually do more than just ...
0
votes
1answer
31 views

Using orderby with 2 meta keys

I can use orderby with one meta key in the WP_Query using following: 'orderby' => 'meta_value_num', 'meta_key' => 'my_key_1', However is it possible to use orderby based on the calculation ...
0
votes
2answers
90 views

get_users with Serialized Custom Meta Value

I'm attempting to use get_users to select users with only a certain meta value. In this case the meta key is extraInfo but the the values are in a serialized array. Can I pull users out like this? ...
0
votes
0answers
279 views

ACF Relationship Field Search Filtering

I am trying to assign relate posts using the ACF relationship field. It has typeahead search to search by post titles. I would like to add meta_data search to the ACF relationship search. This ...