/avada-kedavra

Disables all WordPress shortcodes registered by active theme.

Primary LanguagePHP

Avada Kedavra

Disables all WordPress shortcodes registered by the active theme.

Description

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.

Installation

If you don’t know how to install a plugin for WordPress, here’s how.

Frequently Asked Questions

Will this plugin strip the shortcode tags from my content?

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.

Does the plugin distinct between shortcodes registered by themes and other shortcodes?

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' );

What’s with the name of this plugin?

  1. Guess…
  2. “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.

Screenshots

Content consisting of shortcodes, imported via theme options by a “premium” theme…

screenshot-1.png


…sure looks nice in the front-end…

screenshot-2.png


…until the theme is disabled and all the shortcodes are gone. This plugin simulates what it looks like when shortcodes are not working anymore.

screenshot-3.png

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.

screenshot-3.png

Changelog

0.5

  • Fixed some typos.
  • Fixed text domain.
  • Updated plugin description.
  • Removed unused (global) variables.
  • Updated translations.
  • Improved general usage of PHP, props @tfrommen.

0.4

  • Added admin notices.
  • Added early bailing if logged-in user cannot manage plugins.
  • Added i18n and POT file.
  • Added German language files.

0.3

  • Whitelisted shortcodes registered by core and plugins. Good thinking, @GaryJones!
  • Added filter avada_kedavra_whitelisted_shotcodes to customize whitelist.

0.2

  • Added PHP_INT_MAX as priority, props @boiteaweb.
  • Added filtering for core shortcodes.

0.1

  • Initial release.