[wp-trac] [WordPress Trac] #8962: get_shortcode_regex probrem

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 25 16:51:37 GMT 2009


#8962: get_shortcode_regex probrem
--------------------------+-------------------------------------------------
 Reporter:  smilkobuta    |       Owner:  anonymous
     Type:  defect (bug)  |      Status:  new      
 Priority:  high          |   Milestone:  2.7.1    
Component:  General       |     Version:           
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 Long articles is not displayed because of get_shortcode_regex function.
 this function is invoked by wpautop function, and maybe preg_replace can't
 perform a regular expression which generated in get_shortcode_regex.

 This is wpauto code(there is no probrem).

 {{{
     $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() .
 ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand
 alone
 }}}

 Here is modified code.

 {{{
 function get_shortcode_regex() {
         global $shortcode_tags;
         $tagnames = array_keys($shortcode_tags);
         $tagregexp = join( '|', array_map('preg_quote', $tagnames) );

 //      return '\[('.$tagregexp.')\b(.*?)(?:(\/)?\](?:(.+?)\[\/\1\])?';
     return '\[('.$tagregexp.')\b([^\]]*?)(\/)?\](?:(.+?)\[\/\1\])?';
 }
 }}}

 This modification was written by following blog.
 http://www.brusdeylins.info/wordpress/probleme-mit-shortcodes/

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


More information about the wp-trac mailing list