The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Strip Non Registered Shortcodes for WordPress
Nested shortcodes FIX (2 posts)

  1. kraterdesign
    Posted 4 years ago #


    I use your extension along with WPTouch, so WP Touch doesn't show any shortcode tags in the mobile version of the site.

    I was however having a problem with nested shortcodes, example below:

    [accordion_toggle title="ITEM 1"]
    <blockquote>Bla bla bla</blockquote>
    <div style="clear: both;"></div>
    [accordion_toggle title="ITEM 2"]
    <blockquote>Bla bla bla</blockquote>
    <p style="float: right;"><img title="" src="img.jpg" alt="" /></p>
    <div style="clear: both;"></div>

    Here is my modified version of the regular expression to fix this problem... it works fine now:
    $text = preg_replace("~(?:\[/?)(?!(?:$exclude_codes))[^/\]]+/?\]~s",'', $text); #strip shortcodes WITHOUT SHORTCODE CONTENT



  2. BraveNewCode Inc.
    Posted 4 years ago #

    Thank you for sharing your solution.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Strip Non Registered Shortcodes for WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic