• Resolved LouDB

    (@loudb)


    Hello,

    I’ve noticed a massive increase of AMP errors in Search Console in January. The pages are no longer valid and the AMP validor gives this information:

    The attribute ‘src’ in tag ‘amp-auto-ads extension .js script’ is set to the invalid value ‘https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js’%20defer=’defer’.

    I currently use the latest version of the plugin, I inserted AdSense auto-ad code a long time ago through the Advanced Settings. I checked the code just in case it had changed but it is still valid when entering it “on its own” on the AMP Validator.

    Obviously it doesn’t like the “defer” parameter that is added by the plugin ?? Any idea on how to solve this issue?

    Thank you in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Can you please share your website URL? So we can analyze it and help you fix the issue for you.

    Thread Starter LouDB

    (@loudb)

    Hi, thank you for your reply. I have three sites using the plugin, same issue on the three. Those pages use the plugin:
    https://bit.ly/36w0i8a
    https://bit.ly/2GmQUsS
    https://bit.ly/3aGXlFb

    Thank you!

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    We checked your issue. This issue is not coming from our plugin. On your website, there is adding a defer attribute on your page. so you have to get that error.
    screenshot: https://monosnap.com/file/YVcPyb1iomLR0JaOzgzbYwGKmLgi3K
    AMP is not supported by this defer attribute. This defer is coming because of using some cache plugin. Can you please deactivate all cache plugin and clear cache. Then activate one by one. Then you have to understand which plugin causes this error.

    Thread Starter LouDB

    (@loudb)

    Hi, found the source of the issue. It’s not a plugin, it’s actually a function for deferring the parsing of JavaScript. Not sure why it’s started to cause problems now (I’ve been using the plugin and the function for a couple of years).

    if (!(is_admin() )) {
    function defer_parsing_of_js( $url )
    {
        if(FALSE === strpos( $url, '.js') || ((strpos( $url, 'jquery.ui.core.min') > 0) || (strpos($url, 'jquery.min') > 0))){ 
            return $url;
        }
        else{
            return "$url' defer='defer";        
        }
    }
    add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
    }
    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    This code is not working on AMP. Because AMP could not support the defer attribute. It is working on Non-AMP. So can you please remove this code from AMP? And check once whether having the same issue or not.

    Thread Starter LouDB

    (@loudb)

    Hi, as I mentioned the problem is solved when removing the code ?? I’m just wondering why it used to work well before (I’ve been using this code and your plugin for several years and never had any problem until this January).

    Is there a way to exclude the AMP version from the code?

    Such as if (!(is_amp() )) { or something similar?

    Thanks! By the way, the plugin is really excellent!

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Thank you so much for using our plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Increase of AMP validation errors: invalid value of ‘src’ attribute’ is closed to new replies.