The AMP plugin provides a “Plugin Suppression” capability. When plugins cause validation errors a new section appears on the AMP settings screen listing all plugins currently known to be causing validation errors. Each row of the list includes the plugin name, author, a description with a summary of the validation errors, and a dropdown which allows you to mark the plugin either as “Active” or “Suppressed”.
As soon as it is determined an AMP page is being served, plugins are suppressed by:
- Unhooking filters and actions whose callbacks are defined in the plugin (including hooking into
wp_enqueue_scripts
). - Overriding shortcodes with plugin-defined callbacks to just
__return_empty_string
. - Overriding widgets with plugin-defined callbacks to just
__return_null
. In addition to this, the display is also blocked with thewidget_display_callback
filter to ensure widgets rendered withthe_widget()
are accounted for. - Overriding dynamic blocks with plugin-defined callbacks to just
__return_empty_string
and to also nullify the frontendstyle
andscript
.
When a plugin is suppressed, the Plugin Suppression table indicates its status. The plugin suppression entry for a suppressed also indicated if the plugin has been updated since the time it was suppressed, giving you a chance to see if the plugin changes may have fixed the AMP incompatibility.
This capability makes it easier for you to deal with plugin issues as they arise, controlling their behavior on AMP pages while maintaining their functionality on non-AMP pages.