Support

Account

Home Forums General Issues Archive Filter with Multiple Values Select Field Reply To: Archive Filter with Multiple Values Select Field

  • should go in your functions.php file

    there is a missing ) in the code which is the cause of the 500

    
    add_filter('acf/save_post', 'convert_classes_to_standard_wp', 20);
    function convert_classes_to_standard_wp($post_id) {
      // use a different field name for your converted value
      $meta_key = 'converted_classes';
      // clear any previously stored values
      delete_post_meta($post_id, $meta_key);
      // get new acf value
      $values = get_field('classes', $post_id);
      if (is_array($values) && count($values)) {
        foreach ($values as $value) {
          add_post_meta($post_id, $meta_key, $value, true);
        } // end foreach
      } // end if
    }