Home Forums Bug Reports Repeater on options page returns count


Repeater on options page returns count

  • Hi,

    I am getting a count of the repeater field items as a string only when using the repeater field on my options page instead of a multi-dimensional array of the sub-items. I have another repeater set up on the site that is not on the options page that works as expected.

    I am on wordpress version 3.8 and ACF version 4.3.4

    Thank you

  • Hi @ccernoch,

    What code are you using to output the data?

  • In my functions.php, I am just running

    $hidden_users = get_field('hide-users', 'options'); 

    which produces

    string(1) "2"

    I tried adding/removing items from the list to verify that the number that it is outputting is the count.

  • Hi @ccernoch

    Thanks for the code. The issue here is that you are using the get_field function in the root of the functions.php file.

    The repeater field add-on is currently included during the init action. This action is run AFTER the functions.php file is read, so the issue you are seeing is that the repeater field is not yet loaded and can’t run it’s custom load_value logic.

    To solve the issue, please hook into the init action and run your get_field code there.

    add_action('init', function(){
    $hidden_users = get_field('hide-users', 'options'); 


  • Hi Elliot,

    Thank you for your fast reply and super awesome plugin. It does in fact work perfectly when added in the init action. I guess my issue now is that I am actually trying to use it in a filter to filter out buddypress members that are listed in the site, and apparently the bp_ajax_querystring filter is not running at a time when I can use the repeater fields 🙁

    If you have any suggestions of how to get around it they would be much appreciated, otherwise I will have to figure something else out.


  • Hi @ccernoch

    Thanks for the follow up. Good new is that this issue will be fixed in the next release. Should be out in the next week.


Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Repeater on options page returns count’ is closed to new replies.