WordPress.org

Forums

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

  1. kraterdesign
    Member
    Posted 2 years ago #

    Hello,

    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]
    [accordion_toggle title="ITEM 1"]
    <blockquote>Bla bla bla</blockquote>
    <div style="clear: both;"></div>
    [/accordion_toggle]
    [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>
    [/accordion_toggle]
    [/accordion]

    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

    Regards,

    http://wordpress.org/extend/plugins/strip-non-registered-shortcodes-for-wordpress/

  2. BraveNewCode Inc.
    Member
    Posted 2 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