Support

Account

Home Forums Add-ons Repeater Field Repeater field returns string Reply To: Repeater field returns string

  • The reason this is causing an issue with ACF is that it is also altering the queries that ACF performs to do what it does.

    You will either need to adjust this somehow to only do this on the specific queries that you are interested in changing or you’ll need to use an alternate method of getting the values from the repeater.

    Beyond that I’m not going to be much help other than some advice.

    It may be possible to only add your filters for specific queries this way, but it’s only a guess and I don’t know if it will work or not.

    
    // using this function name for consitency
    add_filter('pre_get_posts', 'atom_pre_get_posts');
    function atom_pre_get_posts($query) {
      if (is_search()) {
        add_filter('posts_where','atom_search_where');
        add_filter('posts_join', 'atom_search_join');
        add_filter('posts_groupby', 'atom_search_groupby');
      }
    }
    

    The other choice is using get_post_meta instead of ACF function

    
    // get the number of rows
    $count = get_post_meta($post_id, 'repeater_field_name', true);
    
    // loop through repeater
    for ($i=0; $i<$count; $i++) {
      // get a sub field
      $value = get_post_meta($post_id, $repeater_field_name_'.$i.'_sub_field_name', true);
    }