Support » Plugin: WP Super Cache » AMP compatibility issue with Version 1.7.8

  • Resolved Nick Leghorn

    (@kc2qcy)


    After updating the plugin, AMP validation is now failing due to the way some of the JS elements added to the page by this plugin are called. Specifically:

    • jquery.min.js
    • jquery.migrate.min.js
    • delete-cache-button-js-extra
    • delete-cache-button.js

    These files are called via a <script> tag, which is not allowed by AMP.

    If y’all are making a conscious decision to ditch the AMP format that’s cool, I’d just appreciate more of a heads up than learning about it in my error notifications.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Donncha Ó Caoimh

    (@donncha)

    @kc2qcy are you using the ampforwp plugin to handle AMP? I’ll patch this so it detects AMP and removes the JS.

    Plugin Author Donncha Ó Caoimh

    (@donncha)

    If it is AMPforWP that you’re using then this patch should take care of it.

    https://github.com/Automattic/wp-super-cache/pull/821

    Thread Starter Nick Leghorn

    (@kc2qcy)

    Hey @donncha, thanks for the quick response! I’m using the AMP plugin from the AMP team here:

    https://wordpress.org/plugins/amp/

    Plugin Author Donncha Ó Caoimh

    (@donncha)

    OK, I’ll add a check, if that plugin is active to disable the JavaScript loading.

    Plugin Author Donncha Ó Caoimh

    (@donncha)

    Hopefully this will detect that plugin:

    is_plugin_active( 'amp/amp.php' )

    If you want to test that, edit inc/delete-cache-button.php and in wpsc_delete_cache_scripts() add this code:

    
    if ( is_plugin_active( 'amp/amp.php' ) ) {
        return;
    }
    

    That should stop the JS loading there. The button won’t work because the patch above fixes some nonce problems but you won’t get amp errors.

    Thread Starter Nick Leghorn

    (@kc2qcy)

    Lovely! Chained it as an elseif off that first logged in user check and that did the trick.

    Plugin Author Donncha Ó Caoimh

    (@donncha)

    New version has just been released. I decided to not load JS files for the frontend because it will be impossible to keep track of all AMP plugins. The JS really isn’t needed anyway for a simple link.

    Thread Starter Nick Leghorn

    (@kc2qcy)

    Smart.

    Updated to 1.7.9, confirmed no issues. Thanks for your help here!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.