Questions tagged [wp-autop]

Changes double line-breaks in the text into HTML paragraphs (`<p>...</p>`). WordPress uses it to filter a posts content and its excerpt per default. This function can be used for autocorrecting any HTML saved to the database (or just displayed). Keep in mind that in the background it is using a time extensive regular expression, so it is considered to slow down your requests.

Filter by
Sorted by
Tagged with
22 votes
3 answers

Switch between Visual and HTML tab freely

So this question has been raised many times under different flags, however I'd like to present a unified thread for an ultimate solution to this issue. In WordPress, by default, when switching back ...
39 votes
11 answers

remove empty paragraphs from the_content?

Hey guys, I simply want to prevent the creation of empty paragraphs in my wordpress post. That happens quite often when trying to manually space content. I don't know why this doesn't take effect? /*...
7 votes
3 answers

Remove wpautop from shortcode content / remove whitespace in buffering

I am using the Mailchimp plugin, and it has a shortcode that uses output buffering to grab its widget's code and spit it out in the content. However, the widget code has plenty of white space, so ...
6 votes
6 answers

How to automatically add paragraph tags in the Visual Editor

From my Googling, it appears as though the default behavior in Wordpress is to add paragraphs automatically, but in the HTML view, regardless of what style I choose in the Visual Editor's style drop-...
  • 161
4 votes
4 answers

Is there un-wp_autop function?

I have a problem with WP that need your help. Some of my posts have content that was applied "wp_autop" filters already. This filter turned all double break lines into <p> tag. I want to the ...
  • 4,032
3 votes
1 answer

wpautop() when shortcode attributes are on new lines break args array

I have a custom shortcode tag with a few attributes, and I would like to be able to display its attributes on new lines - to make it more readable to content editors: [component attr1 ="value1" ...
  • 135
2 votes
2 answers

Is shortcode_unautop() broken?

shortcode_unautop() in /wp-includes/formatting.php is supposed to find shortcodes in a block of text and remove wrapping paragraph tags from them. I've been having issues with paragraph tags making ...
  • 121
2 votes
1 answer

Why does WP not like my <a> container?

Lately I've been working on some shortcodes where all the elements the shortcode produces are wrapped inside an tag. Unfortunately this is not rendered like wanted, because of the filter wpautop on ...
2 votes
3 answers

Remove empty p-Tags in Shortcode content before non p-Tags

We build a media (based on bootstrap 4 media object) shortcode with the following syntax: [media img=""]<h5>List-based media object</h5>Cras sit amet ...
0 votes
1 answer

Formatting <code>?

I have serious trouble displaying code blocks in my theme. I want to display something like: <something> <something-else> Content </something-else> </...
  • 4,991
0 votes
1 answer

Format content value from DB outside of WordPress filters

We're using WordPress to maintain data for a site that gets feed into a JSON file. I've noticed that the post content we add to our file is not getting formatted appropriately. So when we feed it to ...
  • 327