WordPress.org

Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #19927


Ignore:
Timestamp:
12/17/13 01:24:18 (4 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19927 – Description

    initial v2  
    1 In do_shortcode_tag there is some code that allows a shortcode to be escaped. It is commented with  
    2 // allow [[foo]] syntax for escaping a tag 
     1In do_shortcode_tag() there is some code that allows a shortcode to be escaped. It is commented with  
     2`// allow [[foo]] syntax for escaping a tag` 
    33This code is fine if do_shortcode() is only invoked once on a particular chunk of data.  
    44 
    55But if the code is run more than once then the 'escaped' shortcode once again gets selected for processing and the shortcode is expanded. 
    6 e.g. [ [ caption ] ] will be 'escaped' to [ caption ] which then gets processed.  
     6e.g. `[ [ caption ] ]` will be 'escaped' to `[ caption ]` which then gets processed.  
    77  
    88Although this multiple invocation does not normally happen in vanilla WordPress, it is very easy to cause it to occur.  
    99 
    1010In my case I noticed the problem since I had added the filter for 'the_content' with a different priority from the WordPress default. 
    11 e.g. add_filter( 'the_content', 'do_shortcode'); I'd missed the '11'. 
     11e.g. `add_filter( 'the_content', 'do_shortcode');` I'd missed the '11'. 
    1212 
    1313Having removed that offending line of code I then discovered that Artisteer generated themes call get_the_excerpt() as well as the_excerpt() AND I'd added do_shortcode for both these filters. 
    1414 
    1515The fix is simple. Instead of simply removing the outer square brackets, ensure that the first left square bracket is the escaped character [ 
    16  
    17  
    18