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