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
12 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
1answer
26 views

WP Meta Query - mixed AND / OR query doesn't work

I am absolutely boggled by this one. I am creating a search function for a property site - simple enough. Simple queries such as max_price, max_beds, rent_or_buy work ok. But I am trying to create a ...
0
votes
1answer
436 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 ...
18
votes
9answers
23k views

meta_query with meta values as serialize arrays

I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in ...
2
votes
2answers
1k views

Matching Serialized Arrays with meta_query

I've asked a related question previously, but I think I've finally worked out the crux of my issue. I'm using Advanced Custom Fields and have a number of custom fields attached to my post type. I'm ...
0
votes
1answer
28 views

meta_query 'compare' => '!=' not working

I am using a custom post-type, in post there are a checkbox meta field for featured post. So there are two scenarios. First with featured posts Second with non featured When I called featured ...
0
votes
2answers
552 views

How to add follow functionality to multi-author wordpress site?

is there any way to add "follow" functionality to Wordpress ? so that every logged-in user can follow his favorite author and only can see post from authors that he followed them .. A possible ...
0
votes
1answer
26 views

Unpublish Authors With not Fulfilled Fields

I want to unpublish profiles of users that doesn't have all extra fields that I've created filled. I use a custom meta_query in a user taxonomy in order to filter those authors, and that work, but it ...
0
votes
2answers
55 views

Conditional posts in WP_query for search

I have a custom post type that im trying to limit results in search. The CPT is a deal/coupon, with a start and end date for each of the deals. What I'm trying to do is only show these posts in ...
0
votes
1answer
24 views

Exclude posts with certain meta data from search results

I'm trying to exclude al posts with certain meta data from the search results but so far it's not working. Here's the code I'm using: function ZoekGeenLegeItems( $query ) { if( is_admin() || ...
0
votes
1answer
21 views

query post by author gender

I'm using utimate member plugin on my website. for each member (author), I have a field to store the member gender. (Homme / Femme). the data is stored in my database, inside wp_usermeta. meta key ...
0
votes
1answer
594 views

get posts where a custom field contains a text

I have a custom field where the value contains a comma separated list of items (like: test1,test2,test3), now I want to retrieve posts where the field contains one of the values, I have: $query = ...
1
vote
1answer
913 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
1answer
26 views

Wp_query with 2 meta keys and array of meta values

Hi in my post_type=shop i have 2 meta keys and array of values Custom fields Name Values cu_status pending,processing,completed cu_date 12-Jan-2016 , 13-Jan-2016, ...... any ...
0
votes
0answers
28 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
1answer
23 views

Is it possible to retrieve all posts with a certain value for metadata?

Under 4.5, I have posts with meta_key as series and meta_value as 19, 20, etc I am trying to loop through them in a template, and I guess I'm a special kind of dense. Most recently I have tried ...
0
votes
1answer
37 views

WP Meta Query for some meta (array) values

If I get my posts using meta_query by 'my_meta_key' only I get something like this Array( [0] => Array( [nested_key1] => something_I_want1 [nested_key2] => ...
0
votes
2answers
2k views

Displaying Metabox value (custom post type taxonomy)

I have been stuck on this for days, reading articles and articles and nothing works. I am trying to display the value of my metabox on a template page. I successfully added the metabox, and I see ...
0
votes
2answers
3k 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 ...
1
vote
1answer
556 views

Very slow query with meta_query on large database

I have a blog with about 200k posts and each one have 20 custom fields. I've been using WordPress Transients_API to cache queries, in the few cases where it can be used, but it can't be used in some ...
0
votes
1answer
35 views

Query Posts that have or don't have a meta_value and order by the same ASC

I'm trying to perform a scheduled update to all posts, 10 posts at time. To achieve this, I run Cron job with a script that saves 2 post meta: $DATA: the data I want to be update $TIME: the UNIX ...
0
votes
0answers
39 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 ...
0
votes
1answer
52 views

Extending WP Query: Custom geolocation meta values work, but tax_query breaks

I've built a custom query for geolocation searches. I'm saving lat and lng within each custom post type as a meta value. My query extension returns results successfully when lat and lng are the only ...
0
votes
2answers
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 ...
3
votes
1answer
61 views

Nested query inside Logical operator OR not working in meta_query

I've been trying this for hours now and I have searched and haven't gotten a clue. I am trying to make a nested query with OR operator as a parent and AND operator inside it as child. The page keeps ...
0
votes
1answer
42 views

Nested array issue in meta_query

I am using following meta_query to search blog post according to following search criteria, search logic : if expire date set, check the expiry of the post, otherwise just include it if ...
1
vote
1answer
930 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 ...
3
votes
1answer
65 views

WooCommerce conditional meta query

For this question, I know how to solve it but I am hoping there is a better / faster way to solve it. I have a custom meta query in my product loop that doesn't display my product if the stock is 0, ...
0
votes
2answers
27 views

ORDER BY custom field value

Based on example here https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/ I'd like to modify the query $q = new WP_Query( array( 'meta_query' => array( ...
0
votes
1answer
36 views

ORDER BY custom field value out of where clause

Based on example here https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/ I'd like to modify the query $q = new WP_Query( array( 'meta_query' => ...
0
votes
1answer
32 views

Sorting posts by custom fields in meta_query

How to apply 'order_by' in WordPress query in the following example: I have a query to get all posts with custom field for event dates greater or equal current date. I can have up to 10 event dates ...
0
votes
1answer
30 views

Exclude post on loop by multiple meta key value

I need to exclude the loop two post with different values in your meta key (the same). I investigating got this code that works fine if I enter only one value in value =>. But if I want to enter ...
0
votes
3answers
171 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' => ...
1
vote
1answer
66 views

pre_get_posts order by not working

I am using the pre_get_posts hook to alter a query before it runs. The posts in question are performances and so are date and time based. I want to alter the query to get all performances which are ...
0
votes
0answers
34 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
40 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( ...
1
vote
1answer
35 views

WP_Query with different postmeta filter for each categories

Let's say I have categories (cat1, cat2) and I have postmeta keys (date1, date2, status). How do I view all posts in all categories with these filters: For cat1, I want to apply WHERE date2 <= ...
1
vote
1answer
52 views

Two near-identical custom field types - one works, the other doesn't . What can cause this?

I'm using Advanced Custom Fields to add meta information to a custom post type and in ACF I've created two different 'Select'-dropdowns - one is called 'series' the other 'classification'. I run a ...
0
votes
0answers
22 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 ...
1
vote
1answer
61 views

Meta Query with date and time on the same Day before given time

I have a metaquery for a custom post type "events". Their start date is stored as a meta field in this format: 2016-02-05 19:00:00 These are my query args: $args = array( "posts_per_page" ...
0
votes
2answers
56 views

Advanced WP_Query with meta_query, orderby?

I wonder if anyone can help me with this little complex query with ACF. I have the following so far which should display: Pages, News Articles, About Articles and Involved Articles. Show: only ...
1
vote
2answers
144 views

ACF Custom Field WP_Query, but need to get all posts, if field doesn't exist

I have a custom ACF field set on all posts, called event_date, I would like to grab all posts within a given category, but have posts that have event_date defined put first in DESC order of ...
2
votes
1answer
25 views

failed to filter hook `get_terms_defaults`

I've failed to filter hook get_terms_defaults, I got this notices and it won't to load any term Notice: Undefined index: number in /var/www/html/wp-merwaa/wp-includes/taxonomy.php on line 1123 ...
2
votes
2answers
107 views

Sort Popular Posts by Views for the Last Week

I'm trying to sort the popular posts so it shows the most visited in the last week, but it hasn't worked. Anyone have an idea of why it isn't working? <?php $popularpost = new WP_Query( array ( ...
1
vote
1answer
32 views

Meta Query returns wrong number of posts

I am using this meta query inside a category: $args = array( "posts_per_page" => 12, "post_type" => array( "event", "post" ), "post_status" => "publish", ...
1
vote
1answer
40 views

WP Query with custom Shortcode

I have the following in my functions.php:- /** * Shortcode: Latest Properties */ function latest_properties_func( $atts ) { $args = array( 'posts_per_page'=> 5, 'post_type' ...
1
vote
0answers
198 views

get product title ID and price and product picture woocommerce by cat-id query select mysql

i have query that return categories in woo-commerce like this: SELECT wp_terms.term_id AS id, name FROM wp_terms INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id WHERE ...
1
vote
1answer
34 views

Get result from meta_query() between two numbers

I have value like :- if ( ! empty( $_GET['filter-area'] ) ) { $f = $_GET['filter-area']; preg_match_all('!\d+!', $f, $matches); foreach($matches as $key) { ...
1
vote
0answers
34 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 ...
2
votes
1answer
57 views

A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value

I'm looking for a way to basically have an OR relationship between the date_query and the meta_query. Basically I want to combine the two WP_Query's. Get the posts from the last two weeks $args = ...