[wp-trac] [WordPress Trac] #9405: Shortcode parameter names can't have dashes in them

WordPress Trac noreply at wordpress.org
Sat Jul 12 09:44:58 UTC 2014


#9405: Shortcode parameter names can't have dashes in them
--------------------------+-----------------------
 Reporter:  Viper007Bond  |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  lowest        |   Milestone:
Component:  Shortcodes    |     Version:  2.8
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------
Changes (by izem):

 * keywords:  needs-patch => has-patch


Comment:

 Added a patch that update the regex pattern of shortcode_parse_atts
 function at src/wp-includes/shortcodes.php
 The name part of the regex was: (\w+)
 I've changed it to: (\w+(?:\-\w+)*)
 Now it support names with hyphens (but not names that end with a hyphen).

 {{{
 // [sc_test name="val01" name-with-hyphens="val02" name-end-with-
 hyphen-="val03"]
 atts Array:
 (
     [name] => val01
     [name-with-hyphens] => val02
     [0] => name-end-with-hyphen-="val03"
 )
 }}}

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


More information about the wp-trac mailing list