WordPress-Plugin-Template
WordPress-Plugin-Template copied to clipboard
Bug fix plus code enhancements, custom field with type = "color"
Scenario: Add custom field with type = "color" Expected: The field is rendered on the backend and whenever new color is selected the input box value will be updated. Current Behavior: The color is selected but the input value remains blank.
File: includes/lib/class-{custom-post}-admin-api.php Function: display_field() Section: Get saved data
Fixes plus code enhancements - should replace current lines of 35 to 66: // Get saved data $option_name .= $field['id']; ($post) ? $option = get_post_meta( $post->ID, $field['id'], true ) : $option = get_option( $option_name ); if ( isset( $option ) && $option != '' ) { $data = $option; } else if(isset($field['default'])){ $data = $field['default']; } else { $data = ''; }