All Questions
Tagged with custom-field meta-query
196
questions
0
votes
1
answer
26
views
WP_Query not using relation key as expected and not producing any results
I have created a custom post type service-provider with custom taxonomies region and service-category - By itself, this search works as expected BUT I want to also search on an ACF field.
I have an ...
0
votes
2
answers
53
views
How to get products with the same custom attribute like ean code
I Try to get all products with the same ean code, but the query doesn't work and also doesn't give any errors. What am I missing?
Here is the code I use.
if (is_product()) {
global $product;
$...
0
votes
0
answers
20
views
SQL query based on two different custom field values
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 ...
0
votes
1
answer
22
views
Query custom fields with three dates - start and end does not work
I have tried to make a reservation system for a book a table in restaurant.
But, I have a problem when I try to see/ make new reservations in an specific day - in showing me which table are free at ...
0
votes
1
answer
83
views
Order custom post type by posts with most likes first
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 ...
0
votes
0
answers
45
views
Function to Compare CPT Post Custom Value with Default Posts CF Value
I want to create function for compare custom field values of CPT Posts with default posts CF Value. As of now I implemented below code in template file which is working fine, but I want to create ...
0
votes
1
answer
481
views
Display posts with specific value first in query
I would like to display posts that have a certain value in a meta field first. I would like to display posts that have a certain value in a meta field first. I have tried it with meta_query and ...
0
votes
0
answers
24
views
meta_query weird behaviour, static int will work, but not user data
I am currently trying to build a Ajax filter for a CPT, all the products have a min and max value of a specific range in which the products works best. Therefore i created ACF groups with a min and ...
0
votes
2
answers
51
views
Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
So I have a complex list of ACF repeaters for ingredients, but have a save hook to store them all as one comma delimited text string in a custom field to help. My current "advanced" search ...
0
votes
0
answers
41
views
Query multiple post types, but different order for each
I have a query which searches 2 post types as below:
$args = array(
'post_type' => ['post', 'promotion'],
'posts_per_page' => 12,
'paged' => $...
0
votes
2
answers
631
views
Order by the first array within a meta_query
I would like to sort the output of my WP Query. I want the events that are coming up soon to be at the beginning. The events that have already taken place should be at the end. So the first array in ...
0
votes
1
answer
75
views
order the meta query results by 2 custom fields
I have a custom post type 'brewery', I want to fetch results by 2 custom fields. The desired result is to get all posts with highest review rating (value is in decimal like 4.2 or 4.8) and if few ...
0
votes
1
answer
956
views
ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
I am looking for a way to query users based on a user meta entry for an advanced custom field which has a given value and itself is from a given layout type.
For example, let's say I have the ...
0
votes
1
answer
171
views
ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
How can I write a WordPress meta query that gives me an array of users/posts that have a given amount of entries in a custom field that stores multiple values?
Something like SQL COUNT(), but for the ...
0
votes
1
answer
64
views
get posts based on non-single metadata
I have meta data to custom post "event", registered as non-single, i.e., there is an array od metadata "terms" (it is not WordPress term, I just call it term, it is a record ...