Bug on select fields
-
I’ve added a custom field of select type, but the values selected aren’t saved.
So i found this line in funciotn meta_box_save():${$f} = isset( $_POST[$f] ) && is_array( $field_data[$f]['options'] ) && in_array( $_POST[$f], $field_data[$f]['options'] ) ? $_POST[$f] : '';
I don’t think it’s correct, the value of the select it’s matched against texts.
I’ve changed it into:$values = array(); if (is_array( $field_data[$f]['options'] )) $values = array_keys($field_data[$f]['options']); ${$f} = isset( $_POST[$f] ) && in_array( $_POST[$f], $values ) ? $_POST[$f] : '';
Now everything works!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Bug on select fields’ is closed to new replies.