WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 4 months ago

#9045 closed defect (bug) (invalid)

allow shortcode to accept unpaired attributes

Reported by: hailin Owned by: hailin
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Current shortcode doesn't allow format such as:
[shortcode ryan loc=vt s=poet] which contains unpaired attr

there are many cases where some attrs don't have names - so with current shortcode req, we can not use it, and it creates other issues: in wp_trim_excerpt we strip_shortcodes, but we left out some because not all shortcodes can be added in the first place, causing issues in tag, or excepts.

I propose to assign default numeric index to unpaired attributes.

Attachments (1)

9045_shortcode.diff (1.5 KB) - added by hailin 7 years ago.
patch

Download all attachments as: .zip

Change History (5)

@hailin7 years ago

patch

comment:1 @hailin7 years ago

  • Owner changed from anonymous to hailin
  • Status changed from new to assigned

comment:2 @hailin7 years ago

current API only support an edge case: [shortcode 123],
it does not support more complext case, such as [shortcode 123 456] or [shortcode 123 foo=bar] [shortcode foo=bar i=300 123 456 test=iou]

My patch supports all those cases.

comment:3 @hailin7 years ago

  • Resolution set to invalid
  • Status changed from assigned to closed

oops, my bad. I underestimated the long reg ex. the old one can handle the complex cases.

comment:4 @DrewAPicture4 months ago

  • Milestone 2.8 deleted
Note: See TracTickets for help on using tickets.