[wp-trac] [WordPress Trac] #33102: Shortcodes with Quoted Attributes Break Inside of Quoted HTML Attributes

WordPress Trac noreply at wordpress.org
Fri Jul 24 01:07:34 UTC 2015


#33102: Shortcodes with Quoted Attributes Break Inside of Quoted HTML Attributes
--------------------------+------------------------------
 Reporter:  cgrymala      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Shortcodes    |     Version:  4.2.3
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by scamartist26):

 To explain our quick fix, we had a shortcode that years ago we found
 useful on our network site:
 `<a href=["bf_ins field="home_url"]">Home</a>`


 {{{

 function fix_do_shortcode( $text ) {
         $updated_text = preg_replace('/\[bf_ins\s*field=\"(\w*)\"\]/',
 "[bf_ins field='$1']", $text);
         return $updated_text;
 }

 add_filter( 'the_content', fix_do_shortcode' );
 }}}

 This fixes OUR use just fine since the default filter priority is 10 and
 CORE `do_shortcode` is run at priority 11 on `the_content`. Also, this
 specific regex is simply looking how we used it.

 Would there be harm in a better more general filter like this in CORE?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33102#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list