Questions tagged [meta-query]

103 questions
0
votes
1 answer

WordPress query, meta_query, compare BETWEEN, no results

I have code for my filter. It worked well until I add new product in my database. I found the problem, but dont know what to do with that. I have parameters "alc_min" and "alc_max" in my filter. I get these from crawling all products. After I send…
0
votes
2 answers

Wordpress meta_query how to use "like" comparison on meta_key

I have to get posts having a particular meta value for a dynamic meta key. The meta key values will be: _project_global_1_trend_link _project_global_2_trend_link etc... The common text in meta key is trend_link. So I need to add like operator for…
Vishnu Sasidharan
  • 72
  • 1
  • 2
  • 11
0
votes
1 answer

WP_Query - using a variable inside a meta_query array

Hoping someone can help with this... I've got a php variable called $comma_separated, that is a simple array. This gives me as result like this: '558927', '529306', '529227', '50921', '50923', I'm trying to use this…
titus
  • 11
0
votes
1 answer

Search Meta data for a post that has a meta key that has multiple values in WordPress

I am facing an issue with the meta query for my CPT. I have multiple values for a single meta key stored as a string separated with the '|' sign. I want to run a meta query that compares each value numerically and if meta has the >= to searched…
Tariq Khan
  • 109
  • 10
0
votes
0 answers

WP_Query Meta Query returning nothing

I am trying to filter the contents of a WP Query using a meta_query. I have a feeling it's to do with the saved value being a serialised array but I've tried a few fixes online to no avail. Should have all the info you need below in code comments. …
Daniel Vickers
  • 1,054
  • 1
  • 12
  • 32
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…
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
  • 115
  • 2
  • 16
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( …
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
  • 179
  • 1
  • 2
  • 11
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
  • 5
0
votes
2 answers

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
  • 45
  • 1
  • 7
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
  • 15
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
  • 11
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' =>…