Find broken shortcodes

If you recently changed your theme and used shortcodes from it or disabled plugins you maybe want to find all leftovers of them because they are not translated any more. You will find things like [shortcode attribute=”bla”] all over website. Obviously you don’t want to review each post on your website to find them manually. So there comes a little snippet into the game:

This will hook into your footer and print all posts where a broken shortcode was found. Just copy it (for example) into your active theme functions.php. You will find the output as mentioned in the footer. Example output:


Example output of the broken shortcodes snippet.

Now you can find and replace this shortcodes. The snippet just can find the [ so maybe you get wrong results but it’s still better than manually searching. Keep in mind that you can’t search for broken shortcodes through full text search or mysql because you don’t know if the shortcode is translated ( because shortcodes are translated (for example from [shortcode] to actual <span …>…</span>) by php at runtime). Pages are currently not supported but let me know if you need this.

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

  1 comment for “Find broken shortcodes

  1. 14th July 2021 at 00:07

    This worked great. Thanks for the code.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Spelling error report

The following text will be sent to our editors: