Questions tagged [meta-query]
77 questions
0
votes
0 answers
Custom query filter for Custom Post Type that is a registered taxonomy related to the current post
I need your help!
I need to code a custom query filter to fetch posts from a Custom Post Type that is a registered taxonomy related to the current post (which is a diferent Custom Post Type). Working in Wordpress.
Relevant plugins I'm using: CPT-UI…
Ernest
- 1
- 2
0
votes
1 answer
WordPress custom query by meta_key
I'm trying to figure out how to achieve a specific query to modify my search results for posts with WordPress. I'm trying to search via a custom field called "Common Authors".
There can be multiple Common authors, which is causing my query to…
Thomas Miller
- 95
- 1
- 13
0
votes
0 answers
Dynamically populate WordPress meta_query
For a custom post query, I am trying the following:
$meta_query = array( 'relation' => 'OR' );
foreach ($_POST as $key => $value ) {
$meta_query[] = array( 'key' => $key, 'value' => $value, 'compare' => 'LIKE' );
}
$args = array(
…
Kevsterino
- 1
- 1
0
votes
1 answer
Meta Query within a Meta Query?
I'm trying to query 'live' posts for 'venue' field existing (venue field is ID's of venue pages). Query those venue IDs/posts for which ones have a field 'country' that's value (ID) matches a specific country value.
$shows = get_posts(array(
…
50dollanote
- 179
- 3
- 4
- 11
0
votes
0 answers
Wordpress meta_query slow loading
So I have 2 custom fields that I'm querying. The first, 'feature' is a true/false field and video_id is a text input field (which is hidden until another field that has a condition to show it). I basically want to get all posts where feature is…
Fazberry
- 98
- 8
0
votes
0 answers
How to compare field with multi selection and array in meta query in wordpress?
I have a field that contains a few values from select box with multi selection. I need to get some customers that have the same categories.
So I have this array of categories id's.
It's an acf field that contains taxnomey of custom categories and…
oded
- 159
- 1
- 2
- 10
0
votes
0 answers
Wordpress meta Query- weird value in request field
I try to set a meta_query.
With this Value :
$region_meta_query[] = array(
'key' => 'region',
'value' => 'Île-de-France',
'compare' => 'LIKE',
…
Vincent
- 1
- 2
0
votes
1 answer
Wordpress: Wp_Query - find posts with meta_query OR tax_query
I want to find posts which have a specific post meta key/value or posts which are in a specific category. Here is the query. I want to combine the tax_query and the meta_query with OR, but AFAICS there's no way to do this.
$args = [
'post_type' …
verloren
- 21
- 4
0
votes
0 answers
filter out data wordpress
I have a custom 'pre_get_posts' function, that attaches meta_query:
function my_pre_get_posts($query)
{
$query_filters = array(
'color' => 'color',
'size' => 'size',
'type' => 'type',
);
if (is_admin()) {
return…
paper123
- 79
- 6
0
votes
0 answers
Wordpress Meta_query with multiple keys and multiple values
I have a WP Query code like below to check if have post match all post_meta > get that post, else create new post, but the result always show me a post have only loaicua = cua-chinh and loaiphong = phong-khach and i don't know why @@
Can someone…
Nguyễn Văn Đức
- 1
- 1
0
votes
1 answer
WordPress how to use multiple meta_query and meta_key
I'm using a meta_query with a relation 'OR' with two keys to retrieve all tags and it working perfectly
$args = array(
'taxonomy' => 'post_tag',
'hide_empty' => true,
'meta_query' => array(
'relation' => 'OR',
array(
…
C. Max
- 35
- 6
0
votes
0 answers
How to improve WordPress meta_query speed?
I have created filtering system where is executed WordPress Query with lots of meta_query data. In total there are 24 possible filters with various type and compare values.
At the moment there is ~2800 rows within filtering is executed.
Of course,…
Paulius Vitkus
- 129
- 1
- 4
- 12
0
votes
2 answers
How to make meta_query according to dynamic meta_key values in Wordpress?
I'm trying to list some users using the get_users function.
An online learning plugin I use saves some data in user metadata as course_COURSEID_access_from. For example; If the course ID is 123, the metadata is saved as: course_123_access_from. And…
Faruk
- 53
- 10
0
votes
0 answers
Why $wpdb works on localhost but it is not working on server
I am building a plugin in WordPress and $wpdb queries works on local, but when I upload the code to the server it doesn't work.
Here is the code that I'm using:
get_results(
$wpdb->prepare(
…
0
votes
1 answer
Wordpress meta_query relationship
The following query does not work correctly for me,
Where is my mistake in this?
$incidents = new WP_Query([
'post_type' => array('incident'),
'post_status' => 'publish',
'posts_per_page' => 50,
'orderby' => 'ID',
'order' =>…
Rashad Latifov
- 11
- 1