Quantcast
Channel: Question and Answer » meta-query
Browsing index pages (36 articles)

Two near-identical custom field types – one works, the other doesn't . What...

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article


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 $args =...

View Article

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,...

View Article

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...

View Article


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 search:...

View Article

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 4. Only...

View Article

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 in...

View Article


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) { $first_val = $key[0]; $second_val = $key[1]; }...

View Article


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...

View Article

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( 'relation' =>...

View Article

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" => 12,...

View Article

get second ID from array

I need to get the second attachment ID from this function and put it into a separate custom field: add_action('pmxi_saved_post', 'replace_thumbnail', 10, 3); function replace_thumbnail($id) {...

View Article


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' => '334',...

View Article

How loop through posts based on custom fields

I want to loop through posts and show only those posts for which the custom field i.e _shopis not empty I am always confused with meta query and even not sure that if this is possible using this or not...

View Article


How to use meta_query to check if a meta field has something set?

(WordPress 4.3.1) I’m running a custom loop and only want to include posts that have file uploaded to a custom field: audio_file. I have tried many solutions around the web and so far nothing works....

View Article

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...

View Article


meta_query issue with multiple numerics

I’m having an issue with a search form. I basically have 7 input fields used to search different properties. All of them apart from the last two see to be working, as soon as I introduce the last two...

View Article

Query Multiple values for same key

I have tried to get 2 different posts having the values in $al. I can retrieve the posts one at a time but fail to get both together: $al = array('51.66963','51.60652'); $meta_query[] = array(...

View Article

How to fetch WP_User_Query with multiple role arguments [duplicate]

This question already has an answer here: Get multiple roles with get_users 7 answers

View Article
Browsing index pages (36 articles)


Latest Images