Administration: Remove multiple viewport meta tags from mobile pages.
In addition, add the `wp_admin_viewport_meta()` function, paired to the `admin_viewport_meta` filter to control attributes of the meta tag. Fixes #47369. Props BettyJJ, mukesh27, SergeyBiryukov, ajayghaghretiya1, msaggiorato, talldanwp, davidbaumwald, donmhico, audrasjb. Built from https://develop.svn.wordpress.org/trunk@48412 git-svn-id: http://core.svn.wordpress.org/trunk@48181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d322fb66de
commit
1158166d9c
|
@ -90,7 +90,6 @@ var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
|
|||
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
|
||||
isRtl = <?php echo (int) is_rtl(); ?>;
|
||||
</script>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,10 +132,7 @@ $body_class = 'wp-core-ui wp-customizer js';
|
|||
|
||||
if ( wp_is_mobile() ) :
|
||||
$body_class .= ' mobile';
|
||||
|
||||
?>
|
||||
<meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.2" />
|
||||
<?php
|
||||
add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
|
||||
endif;
|
||||
|
||||
if ( $wp_customize->is_ios() ) {
|
||||
|
@ -171,6 +168,13 @@ do_action( 'customize_controls_print_styles' );
|
|||
* @since 3.4.0
|
||||
*/
|
||||
do_action( 'customize_controls_print_scripts' );
|
||||
|
||||
/**
|
||||
* Fires when Customizer control scripts are printed.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*/
|
||||
do_action( 'customize_controls_head' );
|
||||
?>
|
||||
</head>
|
||||
<body class="<?php echo esc_attr( $body_class ); ?>">
|
||||
|
|
|
@ -44,7 +44,8 @@ add_action( 'login_init', 'wp_admin_headers' );
|
|||
add_action( 'admin_head', 'wp_admin_canonical_url' );
|
||||
add_action( 'admin_head', 'wp_color_scheme_settings' );
|
||||
add_action( 'admin_head', 'wp_site_icon' );
|
||||
add_action( 'admin_head', '_ipad_meta' );
|
||||
add_action( 'admin_head', 'wp_admin_viewport_meta' );
|
||||
add_action( 'customize_controls_head', 'wp_admin_viewport_meta' );
|
||||
|
||||
// Prerendering.
|
||||
if ( ! is_customize_preview() ) {
|
||||
|
|
|
@ -1014,14 +1014,34 @@ function wp_color_scheme_settings() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @since 3.3.0
|
||||
* Displays the viewport meta in the admin.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*/
|
||||
function _ipad_meta() {
|
||||
if ( wp_is_mobile() ) {
|
||||
?>
|
||||
<meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1">
|
||||
<?php
|
||||
function wp_admin_viewport_meta() {
|
||||
/**
|
||||
* Filters the viewport meta in the admin.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $viewport_meta The viewport meta.
|
||||
*/
|
||||
$viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' );
|
||||
if ( empty( $viewport_meta ) ) {
|
||||
return;
|
||||
}
|
||||
echo '<meta name="viewport" content="' . esc_attr( $viewport_meta ) . '">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Viewport meta for mobile in customize.
|
||||
*
|
||||
* Hooked to the {@see 'admin_viewport_meta'} filter.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*/
|
||||
function _customizer_mobile_viewport_meta( $content ) {
|
||||
return trim( $content, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-beta1-48411';
|
||||
$wp_version = '5.5-beta1-48412';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue