Skip to main content

Questions tagged [meta-query]

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

I'm displaying three lists of events on my site: past events, current events, and future events. The lists are sorted by a custom date time field. The code I have is currently working, but Wordpress ...
Sam Sabin's user avatar
  • 101
0 votes
1 answer
33 views

I'm trying to create a custom sortable admin column for a custom post type that contains a "repeater" field. The plugin I'm using for this field saves the values as separate entries in the ...
Aayla Secura's user avatar
1 vote
1 answer
49 views

I am trying to select records that have a custom field value that matches a search condition but the result is always all records To register the custom field for my post type I am using the following ...
voromax's user avatar
  • 121
1 vote
0 answers
52 views

I have developed a WP Query that displays posts from a custom post type and taxonomy, and orders them by date using a custom field. The posts have a single Advanced Custom Fields date picker field ...
Mike Hermary's user avatar
1 vote
1 answer
38 views

I have a field called acf date for certain posts and I need to sort these posts by this field, but the value comes in this format: '20240517' and I need to sort the posts in ascending order with this ...
Yojaimito1's user avatar
0 votes
0 answers
33 views

I'm working with lumber and have custom post types with ACF fields for height and width in decimals. I'm trying to sort my posts first by height and then by width. I am using the following code: // ...
Kari Sletten's user avatar
0 votes
0 answers
186 views

I import products to my woocommerce site, and all the imported products have an category called "external". Note: All the external products have a "_ei_product" meta key with an &...
Sidney Sousa's user avatar
0 votes
2 answers
176 views

I am having two custom post type "meet_our_community" and "news" I have added a checkbox field named 'add_to_meet_our_community' from the acf to 'news' post type. Now I when tried ...
Amal's user avatar
  • 11
0 votes
1 answer
63 views

There are JSON functions: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html can be used to search in complex data with MySQL. In the case of meta keys and values it is an issue that ...
inf3rno's user avatar
  • 135
0 votes
1 answer
146 views

My objective here is to collect a series of values from a custom repeater field into a comma separated list so they can be used in a meta query. The first part of this is operational, and I think ...
mtm's user avatar
  • 53
1 vote
0 answers
44 views

Currently, I am using the pre_get_posts action to create a custom query, ordering the posts based on a meta value like so: add_action( 'pre_get_posts', 'my_custom_order' ); function my_custom_order( $...
Jens Draser-Schieb's user avatar
0 votes
0 answers
89 views

I have a custom post type called Projects that includes an ACF field named team_members which uses User as a field type and returns a User Array. I want to filter the post type listing so that the ...
Rizal Kholif's user avatar
0 votes
0 answers
32 views

I have custom post type "store" that has two different custom fields: Coutry and City. When in the single country page I list all the stores in that country. What I would like to do is to ...
chaq's user avatar
  • 1
0 votes
1 answer
652 views

I use getEntityRecords as described in the official data API tutorial (https://learn.wordpress.org/lesson/retrieving-wordpress-data-records/). I.e.: const [searchTerm, setSearchTerm] = useState( ''...
gresch's user avatar
  • 111
0 votes
1 answer
73 views

I'm doing a user query and looking to query users that are in a certain department (custom field) -- this works. Now I'm trying to manipulate the order....I'd like to use the meta_key for position and ...
NW Tech's user avatar
  • 717
0 votes
2 answers
112 views

I have a custom Wordpress query that is using an array of product IDs that exist in an ACF field(these IDs do not line up with the Wordpress post IDs). I would like for the order of the returned posts ...
user19103974's user avatar
0 votes
1 answer
75 views

Records in post_meta as follow: post_id key value 1 price 10 1 price_to 5000 2 price_type 'POA' 3 price 12000 3 price_to 17000 4 price 1200 4 price_to 8000 5 price_type 'POA' Code Snippet <?php $...
Mahesh Thorat's user avatar
1 vote
1 answer
134 views

I am using the Like/Dislike plugin on a custom post type and am trying to order the display of posts by the most like count down to those that have no likes (and no set meta value in the posts meta ...
Mike Hermary's user avatar
0 votes
0 answers
212 views

I have a CPT named 'Physicians', and have assigned an ACF field named locations to that post type — locations is an ACF post object field. I also have a 'Locations' CPT and intend on displaying the ...
Graeme Bryson's user avatar
0 votes
1 answer
760 views

I'm building a search component in a ReactJs application sitting on top of a headless WordPress CMS and I've run into a problem which I can't seem to fix. It might be that I'm doing something ...
Stef's user avatar
  • 103
2 votes
1 answer
222 views

I have a weight class category, where I want to sort by weight so Heavyweight shows at the top, and Flyweight at the bottom. I have created a custom meta field called 'weight' where I store an int ...
Mac Cooper's user avatar
0 votes
1 answer
77 views

Using elementor I'm currently running the following: add_action( 'elementor/query/model-query', function( $query ) { $meta_query = $query->get( 'meta_query' ); $meta_query = array(); ...
BN83's user avatar
  • 101
0 votes
0 answers
173 views

I have a custom post type called promotions. In each promotions' post meta, I store two fields, promo_start_date and promo_end_date. The idea is to only show promotions on the frontend, where the ...
kellymandem's user avatar
1 vote
1 answer
357 views

I'm trying to discover if post exists, based on post_title & metadata post_language. Until now, the best way I discovered, was using methods appearing in posts like this one, this one, or this one....
neoswf's user avatar
  • 125
0 votes
0 answers
93 views

I am working on a form where I am trying to insert a term to a taxonomy. So I have a drop down select with a list of my taxonomies and then the next field is a simple text field where the users will ...
spyfly's user avatar
  • 1

1
2 3 4 5
22