• I had no issue with a different AMP plugin before, and I switched to this one here only because of the Yoast integration. Since then I get error reports from Google Search console with AMP errors for every page: Disallowed attribute in HTML tag ‘img’

    If this is a problem related to this plugin, would the author please fix it immediately?? Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thanks For The Feedback

    Hi @volkerforster,
    Thanks for letting me know about the error in the Google search console. Do you still have the plugin active, and if so, could you please share the URL where that issue exists? I’d like to see if I can help you fix it.

    Thread Starter volkerforster

    (@volkerforster)

    Hi,
    thank you for the responds. Just one example would be

    https://universal-solder.ca/product/usbtinyisp-isp-avr-programmer-atmega-attiny-arduino/amp/

    This forum seems not to have any option to add a picture…? Therefore, I am unable to send a screenshot of Google’s Issue Detail Page.

    Hi @volkerforster,
    Thanks for the URL. If you’d like to add a picture, you could paste in a link from CloudUp if you have an account.

    It looks like another plugin or theme may be filtering the featured image markup to add a <noscript> with that disallowed image.

    https://validator.ampproject.org/#url=https%3A%2F%2Funiversal-solder.ca%2Fproduct%2Fusbtinyisp-isp-avr-programmer-atmega-attiny-arduino%2Famp%2F
    Image in noscript

    It may be doing something like:

    
    add_filter( 'post_thumbnail_html', ...
    

    Here’s that filter in Core: https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/post-thumbnail-template.php#L187

    It looks like the site uses the WPBakery Page Builder plugin. That’s a paid plugin, so it’s hard for me to debug it.

    If you’re willing, it’d be great if you could search all of your plugins for post_thumbnail_html.

    I’ll also see if we could do something on our side to prevent that image from appearing in the <noscript>.

    Thread Starter volkerforster

    (@volkerforster)

    the string was found 5 times:

    plugins\jetpack\modules\lazy-images\lazy-images.php

    plugins\jetpack\modules\theme-tools\content-options\featured-images-fallback.php

    plugins\pb-seo-friendly-images-pro\inc\pro.php

    plugins\woocommerce\includes\class-wc-template-loader.php

    plugins\woocommerce\includes\class-wc-https.php

    Thread Starter volkerforster

    (@volkerforster)

    Any help?

    Hopefully there is a fix, otherwise I must switch back to the AMP plugin I used before I switched to AMP for WordPress. I can’t risk to lose my ranking and to have my AMP pages kicked out of the Google index.

    Suggested Workaround

    Hi @volkerforster,
    Thanks a lot for your patience, and for listing your plugins. The SEO Friendly Images Pro for WordPress plugin seems to be adding a <noscript> tag with that <img>, and that <img> had an invalid value that this AMP plugin didn’t strip.

    https://codecanyon.net/item/seo-friendly-images-pro-for-wordpress/19296704

    Here’s a workaround that you could place in your theme’s functions.php file, or a custom plugin. It worked for me locally:

    
    add_action( 'wp', function() {
    	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
    		remove_filter( 'post_thumbnail_html', array( 'pbSEOFriendlyImagesPro', 'lazyLoadImages') );
    	}
    } );
    

    Could you please let me know if this works for you? Thanks!

    • This reply was modified 6 years, 6 months ago by Ryan Kienstra.
    Thread Starter volkerforster

    (@volkerforster)

    when I add this action to the function.php my website does not work anymore and shows the error:

    Parse error: syntax error, unexpected ‘&’ in /home/univer73/public_html/universalsolder/wp-content/themes/thegem/functions.php on line 2572

    Hi @volkerforster,
    Thanks, that must be frustrating.

    Are the single quotes ' appearing in your editor as carets like `, by chance?

    Though it’s not usually best practice, it might help to try converting all of the single quotes to double quotes ".

    Thread Starter volkerforster

    (@volkerforster)

    Oh… of course, sorry. I did it in a rush and did not realize the nonsense Windows notepad does. Now I used Notepad++, and it works fine.

    The AMP test was successful as well.

    Thanks a lot!

    Hi @volkerforster,
    Thanks for your patience, and it’s great that there’s no AMP error now.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Disallowed attribute in HTML tag ‘img’’ is closed to new replies.