Plugin / Hide Broken Shortcodes

Scott Reilly

Frequently Asked Questions (FAQ)

Install via the built-in WordPress plugin installer. Or download and unzip hide-broken-shortcodes.zip 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
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.
If you want want a shortcode to appear as-is in a post (for example, you are trying to provide an example of how to use a shortcode), can use the shortcode escaping syntax, which is built into WordPress, by using two opening brackets to start the shortcode, and two closing brackets to close the shortcode: [[some_shortcode]] [[an_example style="yes"]some text[/an_example]] The shortcodes will appear in your post (but without the double brackets).
Assuming you want to allow the broken shortcodes ‘abc’ and ‘gallery’ to be ignored by this plugin (and therefore not hidden if broken), you can include the following in your theme’s functions.php file or in a site-specific plugin: /** * Permit certain shortcodes to appear as broken without being hidden. * * @param string $display The text to display in place of the broken shortcode. * @param string $shortcode_name The name of the shortcode. * @param array $m The regex match array for the shortcode. * @return string */ function allowed_broken_shortcodes( $display, $shortcode_name, $m ) { $shortcodes_not_to_hide = array( 'abc', 'gallery' ); if ( in_array( $shortcode_name, $shortcodes_not_to_hide ) ) { $display = $m[0]; } return $display; } add_filter( 'hide_broken_shortcode', 'allowed_broken_shortcodes', 10, 3 );
Yes.

Ratings

4.3
7 reviews

Rating breakdown

Details Information

Version

1.8.2

First Released

28 May, 2009

Total Downloads

13,521

Wordpress Version

2.5 or higher

Tested up to:

4.9.12

Require PHP Version:

-

Tags

Contributors

Languages

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.