[wp-trac] [WordPress Trac] #15600: shortcode_unautop returns emtpy string

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 24 06:12:33 UTC 2011


#15600: shortcode_unautop returns emtpy string
-------------------------------------------------+-------------------------
 Reporter:  mdbitz                               |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  high                                 |   Milestone:  Future
Component:  Formatting                           |  Release
 Severity:  major                                |     Version:  3.0.1
 Keywords:  needs-testing has-patch needs-unit-  |  Resolution:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by masterleep):

 Changing shortcode_unautop to the following fixes the empty post problem,
 although some unwanted <p> tags may be left in that case.

 {{{
 function shortcode_unautop($pee) {
         global $shortcode_tags;

         $pee_orig = $pee;
         if ( !empty($shortcode_tags) && is_array($shortcode_tags) ) {
                 $tagnames = array_keys($shortcode_tags);
                 $tagregexp = join( '|', array_map('preg_quote', $tagnames)
 );
                 $pee = preg_replace('/<p>\\s*?(\\[(' . $tagregexp .
 ')\\b.*?\\/?\\](?:.+?\\[\\/\\2\\])?)\\s*<\\/p>/s', '$1', $pee);
                 if ($pee == NULL)
                         return $pee_orig;
         }

         return $pee;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15600#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list