Make WordPress Core

Opened 16 years ago

Last modified 5 years ago

#6984 new defect (bug)

wpautop() formats the the contents of shortcodes

Reported by: viper007bond's profile Viper007Bond Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.6
Component: Shortcodes Keywords: needs-patch wpautop roadmap
Focuses: Cc:

Description

wpautop(), the bane of my existence as a plugin developer, is at it again.

Here's an example of some PHP wrapped in a valid shortcode in a post of mine:

[code lang="php"]$text = str_replace( array('<p><p>', '</p></p>'), array('<p>', '</p>'), $text);[/code]

The content that gets passed to my shortcode function is this:

$text = str_replace( array('
<p>', '</p>

</p>
<p>'), array('
<p>', '</p>
<p>'), $text);

Expected result: it shouldn't touch the insides of valid shortcodes (like adding line breaks or anything as it is doing now).

Change History (23)

#2 @ryan
15 years ago

  • Milestone changed from 2.7 to 2.8

#3 @ryan
15 years ago

  • Component changed from General to Formatting
  • Owner anonymous deleted

#5 @Denis-de-Bernardy
15 years ago

  • Milestone changed from 2.8 to Future Release

#7 @Denis-de-Bernardy
15 years ago

  • Milestone changed from Future Release to 2.9

#8 @azaozz
14 years ago

  • Milestone changed from 2.9 to Future Release
  • Priority changed from normal to low
  • Severity changed from normal to trivial

Extreme edge case. The shortcode args are passed to the callback that can contain these strings.

#9 @nacin
10 years ago

  • Keywords wpautop added

#10 @mordauk
10 years ago

  • Severity changed from trivial to normal

I may get over ruled here, but I'm changing the priority of this from trivial to normal. As an avid plugin developer that spends 80% of every day working in support forums for plugins, this is a huge issue to me. It has cost me so many hours of support time due to themes modifying wpauto() and causing the contents of my plugin's short codes to break.

#11 follow-up: @collinsinternet
10 years ago

What are your thoughts about changing the priority of when the do_shortcode filter is run from 11 to 9?

Line 407 of wp-includes/shortcodes.php:

add_filter('the_content', 'do_shortcode', 9); // BEFORE wpautop()

The other alternative would be to setup new filters for special shortcodes, but this could be a major pain.

The other alternative would be to create a

#12 in reply to: ↑ 11 ; follow-up: @Viper007Bond
10 years ago

Replying to collinsinternet:

What are your thoughts about changing the priority of when the do_shortcode filter is run from 11 to 9?

This would likely break a ton of plugins. A better solution would be a priority parameter on add_shortcode().

It's pretty easy to run (but hacky) to run your shortcodes earlier today:

http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/

That's the solution I've been using in my plugins for years.

#13 in reply to: ↑ 12 @collinsinternet
10 years ago

Replying to Viper007Bond:

Replying to collinsinternet:

What are your thoughts about changing the priority of when the do_shortcode filter is run from 11 to 9?

This would likely break a ton of plugins. A better solution would be a priority parameter on add_shortcode().

It's pretty easy to run (but hacky) to run your shortcodes earlier today:

http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/

That's the solution I've been using in my plugins for years.


That's what I was afraid of.

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

#15 @miqrogroove
9 years ago

  • Component changed from Formatting to Shortcodes
  • Keywords roadmap added
  • Priority changed from low to normal

We will be discussing this tomorrow in the #feature-shortcode channel. Related: #30531.

#16 @miqrogroove
8 years ago

#12061 was marked as a duplicate.

#17 @miqrogroove
8 years ago

#24085 was marked as a duplicate.

#18 follow-up: @miqrogroove
8 years ago

I've closed several tickets as duplicates, directly and indirectly. We can use this one ticket to track roadmap ideas for fixing filter priorities and registration options. Currently, this is slated for 4.5 Milestone, and we will discuss it more at today's meeting in #feature-shortcode.

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


8 years ago

#20 in reply to: ↑ 18 @usability.idealist
8 years ago

Replying to miqrogroove:

I've closed several tickets as duplicates, directly and indirectly. We can use this one ticket to track roadmap ideas for fixing filter priorities and registration options. Currently, this is slated for 4.5 Milestone, and we will discuss it more at today's meeting in #feature-shortcode.

uhm .. whats the status of this, as 4.5 is definitely shipped, and 4.6 is making its final RC-rounds?

cu, w0lf.

Last edited 8 years ago by usability.idealist (previous) (diff)

#21 @adamsilverstein
7 years ago

#42003 was marked as a duplicate.

This ticket was mentioned in Slack in #core-js by adamsilverstein. View the logs.


6 years ago

This ticket was mentioned in Slack in #core by gordie.lachance. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.