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
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.