Disables all WordPress shortcodes registered by the active theme.
This simple WordPress plugin disables all WordPress shortcodes registered by a theme. Shortcode tags in your content will remain perfectly intact, just to demonstrate what a mess your site will look like when a theme tempts you to build your content based on shortcodes.
If you don’t know how to install a plugin for WordPress, here’s how.
No. Shortcode tags will not be stripped. They stay in place, but they will not be parsed for as long as the plugin remains active. As soon as you deactivate the plugin, your site will look as it did before.
Yes, it does. As of WordPress 4.0, shortcodes registered in WordPress’ core are:
[audio]
[caption]
[embed]
[gallery]
[playlist]
[video]
The plugin will look for those as well as for any shortcodes registered by any plugins upon plugins_loaded
and whitelist all of those. It then will disable all other shortcodes registered after plugins_loaded
upon after_setup_theme
.
If you want to extend the whitelist, you pass additional tags to the array via a filter:
add_filter( 'avada_kedavra_whitelisted_shortcodes', 'your_extend_function_here' );
- Guess…
- “Avada kedavra” is the deadly spell used by Lord Voldemort and his followers in J.K. Rowling’s novel series of Harry Potter. I don’t claim any ownership on the term whatsoever.
Content consisting of shortcodes, imported via theme options by a “premium” theme…
…sure looks nice in the front-end…
…until the theme is disabled and all the shortcodes are gone. This plugin simulates what it looks like when shortcodes are not working anymore.
As a logged-in user who can manage plugins, you will see an admin notice after the plugin has been activated, either informing you that your theme has registered shortcodes and they have been disabled temporarily, or that it hasn’t and that all is well.
- Fixed some typos.
- Fixed text domain.
- Updated plugin description.
- Removed unused (global) variables.
- Updated translations.
- Improved general usage of PHP, props @tfrommen.
- Added admin notices.
- Added early bailing if logged-in user cannot manage plugins.
- Added i18n and POT file.
- Added German language files.
- Whitelisted shortcodes registered by core and plugins. Good thinking, @GaryJones!
- Added filter
avada_kedavra_whitelisted_shotcodes
to customize whitelist.
- Added
PHP_INT_MAX
as priority, props @boiteaweb. - Added filtering for core shortcodes.
- Initial release.