For everyone who is having the issue, please could you check to see if you have a Required field within the repeater?
For me I had a required field in the repeater, making this not required resolved the issue.
Good point, sure thing.
Can someone change the status of this thread, downgrading to 5.7.7 is not a solution.
I have the same issue with the same JS console error message. Downgrading does allow our client to update the page again but still is not a solution.
If didn’t have your people post_object in a group then you’d just change the key to become ‘people’, is your comparator still LIKE?
Hey Julius,
I’ve read a bit more about group fields and the key doesn’t act the same as a repeater.
$author = 85; // This will eventuall be pulled from get_query_var('author')
$images_query = new WP_Query([
'suppress_filters' => FALSE,
'posts_per_page' => -1,
'post_type' => 'images',
'meta_query' => [
//'relation' => 'OR',
//'relation' => 'AND',
[
'key' => 'authors_people',
'compare' => 'LIKE',
'value' => '"'.$author.'"'
],
],
]);
In the second paragraph of the overview for group it says the database saves the result as group_field so in your case it is authors_people. As the people field is a multi select and holding an array of people IDs (I would have thought) then the LIKE comparator should be fine.
Try the above and let me know what you get.
I do not use groups all that often. Although reading here the database saves the key differently. So you need to look in authors_people
You can also remove the filter you added just now.
Because your people is a multi select then I believe you need to use LIKE
Oh Sorry my mistake, can you replace it with :
'"85"'
Oh so you Authors is a repeater and in that you have a multiple select post object that is People? If so try this:
$images_query = new WP_Query([
'posts_per_page' => -1,
'post_type' => 'images',
'meta_query' => [
[
'key' => 'authors_%_people',
'compare' => 'LIKE'
'value' => '"'.85.'"',
],
],
]);
Have a read of this post, Section 4 to be precise: https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
In order to use a % wildcard you need to create a custom field for this query.
See if that works for you.
Hey everyone,
Huzzah! Figured it out with this gem:
http://www.advancedcustomfields.com/resources/tutorials/querying-relationship-fields/
So from the above all I needed to do was change it to the following:
<?php
$args = array(
'post_type' => 'cpt_courses',
'posts_per_page' => 1,
'meta_query' => array(
array(
'key' => 'course_tutors',
'value' => '"' . get_the_ID() . '"',
'compare' => 'LIKE'
)
)
);
// query
$wp_query = new WP_Query( $args );
// loop
while( $wp_query->have_posts() )
{
$wp_query->the_post();
the_title();
// ...
}?>
Notice the following:
‘key’ => ‘course_tutors’,
‘value’ => ‘”‘ . get_the_ID() . ‘”‘,
‘compare’ => ‘LIKE’
Finally got there, hope this helps other people! J
Hello all,
I’m doing a similar thing as above but finding it hard when my post_object has multiple objects.
OK here is what I am doing:
1. Custom post type with Courses in
2. Custom post type with Tutors in
3. On the Courses page there is a post object box where you select which tutors are deliverying the course.
4. On the front end, on the single tutors page, it will list the courses this tutor is delivering.
At the moment on the tutors page I have this:
<?php
$args = array(
'post_type' => 'cpt_courses',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'course_tutors',
'value' => '86',
'compare' => 'IN'
)
)
);
// query
$wp_query = new WP_Query( $args );
// loop
while( $wp_query->have_posts() )
{
$wp_query->the_post();
the_title();
// ...
}?>
Help help would be much appreciated, thanks
Josh
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.