Hide Broken Shortcodes
Hide Broken Shortcodes
Description
By default in WordPress, if the plugin that provides the functionality to handle any given shortcode is disabled, or if a shortcode is improperly defined in the content (such as with a typo), then the shortcode in question will appear on the site in its entirety, unprocessed by WordPress. At best this reveals unsightly code-like text to visitors and at worst can potentially expose information not intended to be seen by visitors.
This plugin prevents unhandled shortcodes from appearing in the content of a post or page. If the shortcode is of the self-closing variety, then the shortcode tag and its attributes are not displayed and nothing is shown in their place. If the shortcode is of the enclosing variety (an opening and closing tag bookend some text or markup), then the text that is being enclosed will be shown, but the shortcode tag and attributes that surround the text will not be displayed.
See the Filters section for more customization tips.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the hooks provided by the plugin.
As an overview, these are the hooks provided by the plugin:
hide_broken_shortcode: Customizes what, if anything, gets displayed when a broken shortcode is encountered.hide_broken_shortcodes_filters: Customizes what filters to hook to find text with potential broken shortcodes.
Installation
- Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically
/wp-content/plugins/). - Activate the plugin through the ‘Plugins’ admin menu in WordPress
- Optionally filter ‘hide_broken_shortcode’ or ‘hide_broken_shortcodes_filters’ if you want to customize the behavior of the plugin
Faq
By default, the plugin only tries to hide broken shortcodes appearing in post/page content, post/page excerpts, and widgets. It does not hide broken shortcodes that may appear in post/page titles, custom fields, menus, comments, etc.
Reviews
Useful Tool - 5-Stars!!!
By Jimmy Lee (shirtguy72) on May 23, 2023
VERY Useful Tool - 5-Stars!!!
Working fine, THANKS!
Excellent
By nemausus30 on January 18, 2023
Super !
For me it works
By sob2 on June 27, 2022
Works Great!
By Morshed Alam (sumon1068) on December 25, 2018
It doesnt work
By zakisp on March 3, 2018
Nice
By mstoneman on June 22, 2017
For beginners, what to do ?
By Flam696 on December 3, 2016
Changelog
2.0 (2025-10-31)
- Change: Discontinue unnecessary explicit loading of textdomain
- Change: Merge
register_filters()intoinit() - Change: Improve documentation for provided filters
- Change: Note compatibility through WP 6.8+
- Change: Note compatibility through PHP 8.3+
- Change: Update copyright date (2025)
- Change: Remove development and testing-related files from release packaging
- Change: Reduce number of ‘Tags’ from
readme.txt
1.9.4 (2021-10-09)
- New: Add DEVELOPER-DOCS.md and move hooks documentation into it
- Change: Note compatibility through WP 5.8+
- Change: Tweak installation instruction
- Change: Tweak TODO entry
- Unit tests:
- Change: Restructure unit test directories
- Change: Move
phpunit/intotests/ - Change: Move
phpunit/binintotests/
- Change: Move
- Change: Remove ‘test-‘ prefix from unit test file
- Change: In bootstrap, store path to plugin file constant
- Change: In bootstrap, add backcompat for PHPUnit pre-v6.0
- Change: Restructure unit test directories
1.9.3 (2021-04-18)
- Change: Note compatibility through WP 5.7+
- Change: Update copyright date (2021)
Full changelog is available in CHANGELOG.md.