WordPress.org

Make WordPress Core

Ticket #12760: shortcodes.diff

File shortcodes.diff, 834 bytes (added by kunalb, 5 years ago)
  • wp-includes/shortcodes.php

     
    293293        return preg_replace('/'.$pattern.'/s', '$1$6', $content); 
    294294} 
    295295 
     296/** 
     297 * Clean up any 'escaped' brackets for unavailable shortcodes. 
     298 * 
     299 * @since 3.0 
     300 * 
     301 * @param string $content Content to clean up. 
     302 * @return string Content with single square brackets for unavailable shortcodes. 
     303 */ 
     304function clean_shortcodes( $content ) { 
     305        $pattern = '\[(\[.*?\])\]'; 
     306 
     307        return preg_replace( '/'.$pattern.'/s', '$1', $content ); 
     308} 
     309 
    296310add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop() 
     311add_filter('the_content', 'clean_shortcodes', 12); // after applying shortcodes 
    297312 
    298 ?> 
    299  No newline at end of file 
     313?>