Home › Forums › Add-ons › Repeater Field › Repeater field returns count of values › Reply To: Repeater field returns count of values
John,
You are a life saver… I’ve identified it down to my custom theme where I have a pre_get_posts filter. My filter was in place so that I could display custom post types on a category page.
Strange behavior though… When ACF is retrieving the field meta data it is being identified as a category is_category() == true
. What I noticed is that the meta query doesn’t have a category name so I just added a check for that and everything is happy now.
Any idea why the custom field query is being identified as a category?
My original filter ($this->customPostTypes has my custom post type names):
if (is_category()) {
$postType = get_query_var("post_type");
if (!$postType) {
$postType = [
"nav_menu_item",
"post",
];
foreach ($this->customPostTypes as $customPostTypes) {
$postType[] = $customPostTypes["type"];
}
}
$query->set("post_type", $postType);
}
return $query;
Updated filter:
if (is_category() && isset($query->query["category_name"])) {
$postType = get_query_var("post_type");
if (!$postType) {
$postType = [
"nav_menu_item",
"post",
];
foreach ($this->customPostTypes as $customPostTypes) {
$postType[] = $customPostTypes["type"];
}
}
$query->set("post_type", $postType);
}
return $query;
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.