WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Hide Broken Shortcodes

Prevent broken shortcodes from appearing in posts and pages.

How can I type out a shortcode in a post so that it doesn't get processed by WordPress or hidden by this plugin?

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).

How can I prevent certain broken shortcodes from being hidden?

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:

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

Does this plugin include unit tests?

Yes.

Requires: 2.5 or higher
Compatible up to: 3.8.3
Last Updated: 2013-12-29
Downloads: 3,698

Ratings

4 stars
4.5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,2,2
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
0,1,0
100,1,1