Support

Account

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;