Support » Plugin: AMP » The tag ‘meta name=viewport’ appears more than once in the document.

  • Resolved mfelicio


    I have just installed the plugin and I am trying to validate the page. I’m getting the message that “viewport appears more than once”. What should I do to fix this issue?


    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Pascal Birchler


    Hi there

    If you check the source code of your non-AMP page at, you’ll notice the same issue there too.

    <meta name="viewport" content="width=device-width, initial-scale=1"> exists two times at the top (lines 4 and 8).

    That is not ideal, although browsers usually do a good job at trying to fix these kind of errors on their own.

    This duplicated code seems to be caused by a plugin incompatibility. Your theme already includes this HTML tag hardcoded in a template (just like the AMP plugin’s reader mode template), but some plugin on your site is adding it again.

    Usually what helps here is trying to temporarily switch to another theme and temporarily disable all plugins, then turn them back on, one by one, to see which one is the culprit. Once you’ve found the culprit, you can reach out to the developer maintaining the plugin or theme.

    Is it possible that the problem is caused by the theme itself?

    I changed to a different theme and the problem disappeared. When I moved back it was there again.

    Thank for the quick reply!

    Plugin Author Weston Ruter


    @mfelicio You are using this theme, correct?

    What plugins are you using?

    Note that this duplicate viewport error will be prevented from leaking to the frontend once the unique constraint is implemented by the sanitizer:

    Nevertheless, it is good to fix the underlying cause.

    @westonruter yes, that’s the theme I am using.


    a3 Lazy Load
    Ad Inserter
    Akismet Anti-Spam
    Classic Editor
    Easy AdSense Ads & Scripts Manager
    GA Google Analytics
    Heartbeat Control by WP Rocket
    OneSignal Push Notifications
    Page Builder by SiteOrigin
    Post Types Order
    SG Optimizer
    SiteOrigin Widgets Bundle
    Smart Youtube PRO
    SwiftThemes Dynamic Thumbnails
    TinyMCE Advanced
    Video Thumbnails
    Yoast SEO

    Plugin Author Weston Ruter


    Thank you. I can reproduce the problem just be activating the page-speed theme. I’m debugging now.

    Plugin Author Weston Ruter


    ok, I can see the problem. The theme is adding it twice.

    First of all, in the theme’s header.php there is:

    <meta name="viewport" content="width=device-width, initial-scale=1">

    Then in framework/hybrid/inc/functions-head.php there is:

    add_action( 'wp_head', 'hybrid_meta_viewport', 1 );


    function hybrid_meta_viewport() {
    	echo '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "\n";

    So a quick fix for you is just to add this to a custom plugin or a child theme’s functions.php:

    add_action( 'after_setup_theme', function() {
    	remove_action( 'wp_head', 'hybrid_meta_viewport', 1 );
    } );

    That fixes the problem.

    Thank you, it worked perfectly!

    Such a great support.

    I got pinged on this because the theme is using my Hybrid Core framework.

    I just wanted to comment here and tag @gandham to make him aware of the issue in the theme.

    Plugin Author Weston Ruter


    @mfelicio FYI: This validation error will be caught and sanitized automatically in the next version (v1.2) of the plugin. See

    Thanks @greenshady , I will make the necessary change.

    Thanks @westonruter for going though our code and identifying the problem.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘The tag ‘meta name=viewport’ appears more than once in the document.’ is closed to new replies.