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

2
votes
0answers
61 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 ...
1
vote
0answers
48 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
44 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
190 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
117 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
57 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
148 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
43 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
213 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
103 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
76 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
92 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
132 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
365 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
380 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
614 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
544 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, ...
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
0answers
10 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
0answers
22 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 ...
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
0answers
23 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
0answers
29 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
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 ...
0
votes
0answers
25 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
0answers
19 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
0answers
14 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 ...
0
votes
0answers
57 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" ...
0
votes
0answers
25 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
0answers
264 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 ...
0
votes
0answers
37 views

Get closest event where meta_key field is an array

I have a custom post type called "Event", which contains a repeatable date field _cmb2_date . I have a function which prints out posts: function post_style_6($args) { global $post; $the_query ...
0
votes
0answers
43 views

get_post_meta doesn't work with variable

The $event_count variable doesn't prints anything, what am i doing wrong? global $post; $event_count = get_post_meta($post->ID, 'eab_event-bp-group_event', true); $args = array( 'post_type' ...
0
votes
0answers
43 views

How build search with filleting custom taxonomy and custom fields

I wanna explain about my search box, actually what i want to make. Ive a search input and few check boxes to filter the search result. i need to search like this : [Country1] AND ( [venue1] OR ...
0
votes
0answers
60 views

WP_Query with meta_value_num and meta_query not paged correctly

I have a strange thing with my WP_Query, where isn't paged correctly. $args=array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $limit, // 10 ...
0
votes
0answers
21 views

Meta query not returning results even though the sql contains the information

My page is not returning any results for my meta_query, just spits out the content in chronological order without applying the meta search. I am hoping you are able to assist. PS - This post has ...
0
votes
0answers
102 views

Query Posts with meta_query key in array

I am trying to query posts using meta_query to get a series of dates stored as an array in the key repeat_intervals. I am able to query the first date using the following: global $post; query_posts( ...
0
votes
0answers
42 views

posts_clauses : Filtering Posts by multiple meta posts issue

Im trying to write function to filter posts by country and language, but as I see here posts are not filtered and I cant detect where is the problem. This is my code inserted in beginning of my ...
0
votes
0answers
56 views

Multiple compare issue using meta_query

I want search query where $_GET['time'] is equal and between happy_hour_start_time and happy_hour_end_time. Below mention query is not working properly. Please suggest me solution. $meta_query[] = ...
0
votes
0answers
89 views

WP_Query with UNIX timestamp in meta query

now idea why this isn't working, please point me in the right direction! Here's my main query; $events = new WP_Query( array( 'posts_per_page' => -1, 'meta_query' => array( ...
0
votes
0answers
37 views

Attempting to modify cpt archive with query var

I have a custom post type, messages (slug is watch), and I added a query var, speaker, as well as the rewrite. If the url is /watch/speaker/Speaker+Name it modifies the query to include that. If it's ...
0
votes
0answers
67 views

List Most Read Posts from last 7 days (with custom post type and other meta queries)

I am using following code in my functions.php to count the views of the post. // function to display number of posts. function getPostViews($postID){ $count_key = 'post_views_count'; $count = ...
0
votes
0answers
47 views

Events with multiple event dates + permalink for each date

Hope you're well. I was wondering how to achieve something like this in wp: Bascally it's a list of events ordered by the event date. I know how to do that. But the tricky part is that an event may ...
0
votes
0answers
133 views

How to show specific meta keys of all posts in admin panel?

I have some common meta keys on every post. Ex: hotel_person, hotel_number All the posts have these two meta keys. I want to show these meta key values and the post titles. All these values and ...
0
votes
0answers
26 views

Ordering a custom meta query

I have a events custom post type. Each event has to meta fields: eventstart and eventend. These are both YYYY-MM-DD style dates. I am trying to get a list of my events that have a start date OR end ...
0
votes
0answers
92 views

How can get Custom Posts Sort by Hour

I need to show posts from 00:00:00 AM to 00:00:00 PM, and orderby day too. How can i do that? Look the following code: $programasQuery = new WP_Query(array( "post_type" ...
0
votes
0answers
474 views

Custom Upcoming Events List for Events Manager Plugin

I'm using Events Manager plugin. I want to list upcoming events without widget. (2 event with big thumbnail image, after then 4 event with small thumbnail image.) Tried this code: <?phpfunction ...
0
votes
0answers
34 views

Orderby Meta Value and Query from Meta Query

The following query is returning blank with no errors and I'm not sure why. Query Arguments: $args = array( 'post_type' => 'games' , 'posts_per_page'=> -1, 'meta_query' ...
0
votes
0answers
68 views

How to compare date in post meta value

I have some custom meta fields. Some are date fields but WordPress saves everything as a string, so how can I compare the dates? $meta_query_args = array( 'relation' => '', // Optional, ...