Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10548 closed enhancement (duplicate)

There should be way to prevent WP from touching the content within a shortcode

Reported by: godfreykfc's profile godfreykfc Owned by:
Milestone: Priority: low
Severity: normal Version:
Component: Shortcodes Keywords:
Focuses: Cc:

Description

I fail. Reposted with proper formatting:

It is very furstrating now that "do_shortcode" is called after all the WP formatting stuff (e.g. wpautop, escaping html entities) because the content are usually messed up. There should be an option to get the RAW content.

Possible use cases:

  • Create a [noformat]...noformat shortcode
  • Create a [style]...style shortcode, which will put the content into a <style> element and inject it into the <head>
  • Create a [markdown]...markdown shortcode, which formats the content with markdown
  • Mini template language like the conditional custom fields shortcode plugin (or the php shortcode plugin)

Obviously, it is undesirable to have the content preformatted in either of the use cases listed above. For instance, in the CSS example, you'd have to go through the trouble of unescaping the HTML entities and then removing all the <br /> and <p> insterted by wpautop.

The trivial solution would be to put do_shortcode before the other formatting filters. However, this might have potential drawbacks too. For instance, the "unsafe" HTML inserted by the shortcode might get stripped too. (Which might or might not be a good thing). This enhancement obviously requries more thoughts so I'd like to see more disscusion of the potential advantages and disadvantages here.

Change History (1)

#1 @dd32
15 years ago

  • Milestone Unassigned deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of many.

#6969 #6444

Note: See TracTickets for help on using tickets.