Support

Account

Home Forums Add-ons Options Page Get all fields from option page Reply To: Get all fields from option page

  • I personally would set autoload for the options page to true and then just get each fields using get_field('field_name', 'options') or the_field('field_name', 'options')

    Or, if there are a lot of fields I would name them in a way that would let me create a loop if there was some way to standardize the output for all of them.

    
    $sfxs = array('left', 'right');
    foreach ($sfxs as $sfx) {
      the_field('footer-'.$sfx, 'options');
    }
    

    If your concern is the number of db queries made then using the autoload feature for the options page is the solution.

    If your concern is the number of times you need to type out $variable = get_field("field_name", "option"); I don’t have a solution.

    There isn’t a way to get all of the values for a specific options page in a single call. You can use get_fields('options'), but this will return all options for all ACF options pages and not for a specific page. Because the values are stored in the options table there is not association with a specific options page.