Make WordPress Core

Opened 5 years ago

Closed 2 years ago

Last modified 2 years ago

#15434 closed enhancement (wontfix)

Allow escaped quotes in shortcode atts

Reported by: 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 4 years ago.
Patch for escaping quotes and apostrophes in shortcode attribute values.

Download all attachments as: .zip

Change History (9)

comment:1 @scribu5 years ago

  • Type changed from feature request to enhancement

comment:2 @markjaquith5 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.

comment:3 @markjaquith5 years ago

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

comment:4 @rbachlec4 years ago

  • Keywords has-patch needs-testing added

@rbachlec4 years ago

Patch for escaping quotes and apostrophes in shortcode attribute values.

comment:5 @networksolution2 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 2 years ago by SergeyBiryukov (previous) (diff)

comment:6 @networksolution2 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

comment:7 @networksolution2 years ago

  • Cc networksolution added

comment:8 @SergeyBiryukov2 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.