WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 11 months ago

Last modified 11 months 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:

Description

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

Download all attachments as: .zip

Change History (9)

comment:1 scribu3 years ago

  • Type changed from feature request to enhancement

comment:2 markjaquith3 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 markjaquith3 years ago

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

comment:4 rbachlec3 years ago

  • Keywords has-patch needs-testing added

rbachlec3 years ago

Patch for escaping quotes and apostrophes in shortcode attribute values.

comment:5 networksolution11 months 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...

Regards.
Dr. Marco Marsala
http://www.realizzazionesitigenova.it

Version 3, edited 11 months ago by networksolution (previous) (next) (diff)

comment:6 networksolution11 months 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 networksolution11 months ago

  • Cc networksolution added

comment:8 SergeyBiryukov11 months 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.