skip to Main Content

Custom Meta Viewport Tag

This snippet shows how you can alter the default meta viewport tag in the theme. By default the theme uses a responsive tag (the snippet example shows the default tag used by the theme) which also allows zooming into the site on mobile devices. If you wish to disable zooming you may consider using a custom tag.

/**
 * Change the meta viewport tag.
 *
 * @link https://total.wpexplorer.com/docs/snippets/custom-metaviewport-tag/
 */
add_filter( 'wpex_meta_viewport', function() {
    return '<meta name="viewport" content="width=device-width, initial-scale=1">';
} );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top