Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#15434 closed enhancement (wontfix)

Allow escaped quotes in shortcode atts

Reported by: mtymek's profile mtymek Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Shortcodes Keywords: has-patch needs-testing 2nd-opinion
Focuses: Cc:


It would be really helpful for plugin that I'm developing now, if you allowed shortcodes similar to this one:

[my_shortcode param="param with \"escaped\" quotes"]

Attachments (1)

wordpress_#15434.patch (1.5 KB) - added by rbachlec 12 years ago.
Patch for escaping quotes and apostrophes in shortcode attribute values.

Download all attachments as: .zip

Change History (9)

#1 @scribu
13 years ago

  • Type changed from feature request to enhancement

#2 @markjaquith
13 years ago

  • Type changed from enhancement to feature request

Let's investigate how hard it would be to modify the regex to accommodate this. Seems like a reasonable thing to have.

#3 @markjaquith
13 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Type changed from feature request to enhancement

#4 @rbachlec
12 years ago

  • Keywords has-patch needs-testing added

12 years ago

Patch for escaping quotes and apostrophes in shortcode attribute values.

#5 @networksolution
10 years ago

Hi. You can use ' that is the HTML entity for single quote in shortcode attributes, if he purpose is to display the value of that shortcode attribute.

Remember that attributes not to be displayed should be intended as variables in a programming Language, so complex strings as value aren't a requirement. It would be bad programming to pass via attributes things like html code (the only one exception would be, for example, for a title attribute to be displayed, in this case you may use html entities as stated before). If you need to pass complex data, pass an id and retrieve data from db/file in the php code...

Dr. Marco Marsala

Last edited 10 years ago by SergeyBiryukov (previous) (diff)

#6 @networksolution
10 years ago

  • Keywords 2nd-opinion added
  • Resolution set to wontfix
  • Severity changed from normal to trivial
  • Status changed from new to closed
  • Version set to 3.5.1

#7 @networksolution
10 years ago

  • Cc networksolution added

#8 @SergeyBiryukov
10 years ago

  • Milestone Future Release deleted
  • Severity changed from trivial to normal
  • Version 3.5.1 deleted

No traction in 2 years, so I tend to agree with the wontfix.

Another workaround is to use different types of quotes:

[my_shortcode param="param with 'escaped' quotes"]
[my_shortcode param='param with "escaped" quotes']
Note: See TracTickets for help on using tickets.