Support

Account

Forum Replies Created

  • @tulip I had a similar issue which was caused by have_rows() running too early in my code. Ensure that it’s after WP has loaded the plugins and it should hopefully fix it.

  • This can also happen if you call get_field too early, I had a case where I called it at the top of the functions.php file in a $_GET check and it wouldn’t load the data for a repeater field, just the number of elements.
    For Example:

    
    if( $_GET['dostuff'] == 'yes'){
      $data = get_field('fieldname', 'option');
      //do stuff
      //$data returned "3"
    }

    I solved this by moving it to a function in an init action

    
    if( $_GET['dostuff'] == 'yes'){
    add_action('init', 'functionname');
    }
    function functionname(){
      $data = get_field('fieldname', 'option');
      //do stuff
      //$data returned array
    }
    
  • This can also happen if you call get_field too early, I had a case where I called it at the top of the functions.php file in a $_GET check and it wouldn’t load the data for a repeater field, just the number of elements.
    For Example:

    
    if( $_GET['dostuff'] == 'yes'){
      $data = get_field('fieldname', 'option');
      //do stuff
      //$data returned "3"
    }

    I solved this by moving it to a function in an init action

    
    if( $_GET['dostuff'] == 'yes'){
    add_action('init', 'functionname');
    }
    function functionname(){
      $data = get_field('fieldname', 'option');
      //do stuff
      //$data returned array
    }
    
  • Options Page with a Repeater field is not working – doing a get_field(‘repeaterfield’,’option’); returns the number of rows instead of the usual array of sub-fields. have_rows(‘repeaterfield’, ‘option’) while or ifs do not work at all. This appears to be a bug.

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