• function DecadeSelect($field) {

    $currentDecade = substr(date('Y'),0,3)*10;
     BugFu::log($field);
    // Create choices array
    $field['choices'] = array();
    // Add blank first selection; remove if unnecessary
    $field['choices'][''] = '--Select Decade-- ';
    
    // Loop through a range of years and add to field 'choices'. Change range as needed.
    for ($decade = $currentDecade; $decade <= $currentDecade-150; $decade+10) {
      BugFu::log("The decade is: $decade <br>");
    
        $field['choices'][$decade] = $decade;
    
    }
    
    // Return the field
    return $field;

    }

    add_filter(‘acf/load_field/key=field_63442a0323a13’, ‘DecadeSelect’);

    Am I doing this the right way, and where would you expect the log to be?

  • The topic ‘Am I doing the right?’ is closed to new replies.