get_control( $automotive_services_setting->id ); if ( array_key_exists( $automotive_services_input, $control->choices ) ) { return $automotive_services_input; } else { return $automotive_services_setting->default; } } // Sanitization callback function for numeric input function automotive_services_sanitize_numeric_input($automotive_services_input) { // Remove any non-numeric characters return preg_replace('/[^0-9]/', '', $automotive_services_input); } // Sanitization callback function for logo width function automotive_services_sanitize_logo_width($automotive_services_input) { $automotive_services_input = absint($automotive_services_input); // Convert to integer // Ensure the value is between 1 and 150 return ($automotive_services_input >= 1 && $automotive_services_input <= 300) ? $automotive_services_input : 150; // Default to 270 if out of range } function automotive_services_sanitize_copyright_position( $automotive_services_input ) { $valid = array( 'right', 'left', 'center' ); if ( in_array( $automotive_services_input, $valid, true ) ) { return $automotive_services_input; } else { return 'right'; } } function automotive_services_sanitize_dropdown_pages( $automotive_services_page_id, $automotive_services_setting ) { // Ensure $automotive_services_input is an absolute integer. $automotive_services_page_id = absint( $automotive_services_page_id ); // If $automotive_services_page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' == get_post_status( $automotive_services_page_id ) ? $automotive_services_page_id : $automotive_services_setting->default ); }