Opened 16 years ago
Last modified 6 years ago
#6984 new defect (bug)
wpautop() formats the the contents of shortcodes
Reported by: | 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)
#8
@
15 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.
#10
@
11 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:
↓ 12
@
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:
↓ 13
@
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
@
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.
#15
@
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.
#18
follow-up:
↓ 20
@
9 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.
9 years ago
#20
in reply to:
↑ 18
@
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.
See also: #6969