wp-includes/class-wp-theme-json.php:826Sanitizes and normalizes viewport breakpoint settings.
$viewport_settingsmixedarray private static function sanitize_viewport_settings( $viewport_settings ) { if ( ! is_array( $viewport_settings ) ) { return static::DEFAULT_VIEWPORT_BREAKPOINTS; } $breakpoints = array(); foreach ( array_keys( static::DEFAULT_VIEWPORT_BREAKPOINTS ) as $breakpoint ) { $value = $viewport_settings[ $breakpoint ] ?? null; $px = static::get_viewport_breakpoint_value_in_pixels( $value ); if ( null !== $px ) { $breakpoints[ $breakpoint ] = array( 'value' => trim( $value ), 'px' => $px, ); } } if ( empty( $breakpoints ) ) { return static::DEFAULT_VIEWPORT_BREAKPOINTS; } if ( 1 === count( $breakpoints ) ) { $breakpoint = key( $breakpoints ); return array( $breakpoint => $breakpoints[ $breakpoint ]['value'] ); } $sanitized = array( 'mobile' => $breakpoints['mobile']['value'] ); if ( isset( $breakpoints['tablet'] ) && $breakpoints['mobile']['px'] < $breakpoints['tablet']['px'] ) { $sanitized['tablet'] = $breakpoints['tablet']['value']; } return $sanitized; }Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
src/wp-includes/class-wp-theme-json.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.