Skip to content

Instantly share code, notes, and snippets.

@Zodiac1978
Created September 3, 2024 11:14
Show Gist options
  • Save Zodiac1978/43884c931472b6c337f307cc5db76dad to your computer and use it in GitHub Desktop.
Save Zodiac1978/43884c931472b6c337f307cc5db76dad to your computer and use it in GitHub Desktop.
Modify the meta viewport setting in the Divi theme
<?php
// Source: https://divi.help/threads/the-user-scalable-no-attribute-is-used-in-the-meta-name-viewport-element-or-the-maximum-sc.10458/
/**
* Remove the default viewport meta from Divi.
*/
function db_remove_et_viewport_meta() {
remove_action( 'wp_head', 'et_add_viewport_meta' );
}
add_action( 'after_setup_theme', 'db_remove_et_viewport_meta' );
/**
* Add new viewport meta line to head.
*/
function db_enable_pinch_zoom() {
echo '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">';
}
add_action( 'wp_head', 'db_enable_pinch_zoom' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment