Questions tagged [meta-query]

77 questions
0
votes
0 answers

display events by month (cpt)

I've modified this post a few times, asking for help. And I finally got it figured out, so I thought I would share what worked for me. The goal was to create a Meta Query in Wordpress on a Custom Date Field, in a custom post type. Not the WP Core…
MARWEL58
  • 21
  • 2
0
votes
1 answer

custom wp_query where meta_key is variable or not needed

To make a custom post type filterable and sortable, i created a custom query that works based on variables in url, accessed by $_GET. One specific situation breaks it. This is an (un)specified metakey. In the case of sort, the metakey is needed when…
Kees
  • 166
  • 1
  • 14
0
votes
1 answer

Wordpress meta query not working with dynamic parameters

I'm trying to make a call using a custom end-point to one custom post type on my project. I'm passing dynamic parameters to that function- // $per_page = $_GET['per_page']; // $page = $_GET['page']; $per_page = 18; $page…
0
votes
1 answer

Query a custom post type by another custom post type value linked to it by an ACF relationship field

I want to query a Custom post type Person, filter those people by their first name and the name of the City they are living in. But I don't know the ID of the City but only it's name. The City is in my case another custom post type, linked to the…
0
votes
1 answer

Pre_get_posts meta query filter posts

I'm trying to hide all posts with past date(which is a custom field). I'm doing it with pre_get_posts, but no matter what I do, all pages become 404 not found, and I can't find the problem. Here is the function: function hide_past_events( $query )…
CritingZ
  • 174
  • 1
  • 13
0
votes
1 answer

Meta Query being igored in WP

I am attempting a meta query to get between two prices set as a meta field in my custom post. However the _ccprop_prop_price query is being ignored. Its still giving results higher than 100000 , I can confirm the id of the meta field is…
Adrian
  • 1,880
  • 4
  • 35
  • 96
0
votes
1 answer

How to make wp to compare meta value from associated array

I have used Wordpress meta query with LIKE operator But it displays below kind of characters in my query when I am trying to debug issue: Actual Code (in file): LIKE…
0
votes
2 answers

How to add filter to meta_query like finding only Roma Numeric

I have some situational problem with meta_query. Customer Search IV, but result is included prIVate (original word is private). I want to show only IV (roma numeric) included post. My meta_query search from Title, sub title and description in Custom…
Bayanaa
  • 43
  • 7
0
votes
0 answers

Sort posts using ACF/post_meta date field, if none set, use post date

Hoping someone can help me! So i’ve created a custom post type, and assigned a date/time selector do it. I have altered the loop to include my custom post type, and want to sort so that if a date is set to a post, then it sorts by that date selected…
0
votes
2 answers

wordpress Wp_query and meta query issue with date field

I have Projects inserted as posts in my WordPress database. currently on my home, the last 3 published project is displayed. now my purpose is that I want first display the project which is expiring today than the last published project. for…
Code Embassy
  • 179
  • 12
0
votes
1 answer

Problem with meta query compare event date

I have some problem with my custom post event. I would like to show only events with date is equal or greater than today, but my codes does not work properly and show all events from past and future. My code: Register Custom Post Type in…
ceki10
  • 71
  • 1
  • 9
0
votes
0 answers

WordPress - why is this meta query returning results outside the date query?

I am running a meta query to pull out past custom post types (named 'show') between two dates. The dates are any show between the 1st jan 2000 and 31st dec 2009 $end_2000s = '20091231'; $start_2000s = '20000101'; $row = 1; $args = array( …
Martin
  • 63
  • 2
  • 11
0
votes
0 answers

How to Get query_posts from two 'meta_value' in infinite scroll Wordpress

I am trying to get post by two meta value key, and is working fine in normal page but is not working on infinity. The problem is that, there is no post request received when the page is scrolled. Please see the code below. I have done many search…
0
votes
1 answer

Filtering Data with WP_Meta_Query

I want to search restaurant by their sit capacity. I will select a number from dropdown and I have to show restaurants between minimum and maximum sit capacity. I tried below code. But it always shows no results. $_seating_capacity =…
weaver
  • 365
  • 1
  • 3
  • 17
0
votes
2 answers

ACF checkbox meta query

The below isn't working, can't see why. is_focus_product is a True/False ACF field $ls = get_posts([ 'meta_query' => [ [ 'key' => 'is_focus_product', 'value' => 1, 'compare' => '=' ] ] ]); // array(0){} However…
ggdx
  • 2,672
  • 4
  • 28
  • 45