[wp-trac] [WordPress Trac] #26649: escaped shortcodes should not be expanded during 'get_the_excerpt'

WordPress Trac noreply at wordpress.org
Mon Dec 16 15:13:48 UTC 2013


#26649: escaped shortcodes should not be expanded during 'get_the_excerpt'
--------------------------+-----------------------------
 Reporter:  bobbingwide   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:  3.7.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 It is possible for "the_content" filter to be invoked while processing
 "get_the_excerpt".

 If the do_shortcodes() filter hook is attached to both "the_content" and
 "get_the_excerpt" then this can lead to an unexpected expansion of an
 escaped shortcode.

 This can lead to unwanted side effects, as reported here.
 http://www.oik-plugins.com/2013/12/escaped-shortcodes-unexpectedly-
 expanded-get_the_excerpt/


 This minor problem can be alleviated by a simple change to
 strip_shortcode_tag(), returning the HTML code [ as the first
 character rather than the left square bracket.
 {{{
 function strip_shortcode_tag( $m ) {
         // allow [[foo]] syntax for escaping a tag
         if ( $m[1] == '[' && $m[6] == ']' ) {
                 return "[" . substr($m[0], 2, -1) ;
         }
         return $m[1] . $m[6];
 }
 }}}

 I don't believe that it's necessary to make the same change in
 do_shortcode_tag().

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26649>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list