Skip to main content

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
-1 votes
0 answers
29 views

wordpress 6.7 upgrade - remove wpautop

I have a client site that recently upgraded to 6.7. Now I can't turn the rogue <p> tags off on the front end. All the plugins don't work, and haven't been tested with this version. Then I tried ...
Venessa Moffat's user avatar
0 votes
0 answers
24 views

How can I remove the wp_autop filter from a shortcode block in a block theme page template (twenty twenty-three)?

I am using a custom page template in the "twenty twenty-three" theme. I am using a shortcode block as part of the template. This results in the shortcode not running within "the_content&...
Scott H's user avatar
  • 31
1 vote
1 answer
85 views

shortcode causes broken paragraph tags

I'm learning how to use short codes but I don't undrestand why WordPress keeps rendering broken paragraph tags. I created a file called wp-content/themes/twentytwentythree/templates/single.html with ...
learningtech's user avatar
0 votes
0 answers
103 views

What hook runs wpautop on template content?

I have a shortcode that outputs HTML and I've inserted it into a single post template. The output gets extraneous <br/> and <p> tags, which I've read in other topics are likely due to ...
Aayla Secura's user avatar
0 votes
0 answers
31 views

Line Breaks are stripped off when direction property is found

The line breaks are stripped off when the p tag has a dir attribute inserted, to explain further I'll list some examples. Let's say we have 2 lines of text as following <p>Text Paragraph Number ...
David Buik's user avatar
0 votes
0 answers
293 views

Disable wpautop on Shortcode attributes

I have a shortcode which accepts basic HTML tags as shortcode attribute. When this shortcode is used in the shortcode block i.e within <!-- wp:shortcode --> then unbalanced <p> tags are ...
Aakash Chakravarthy's user avatar
1 vote
0 answers
763 views

Removing "wpautop" (auto <p> tags) only on certain pages?

I'm using the remove_filter in functions.php to remove the auto insertion of <p> and <br> tags on my wordpress site. remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt'...
Oneezy's user avatar
  • 111
1 vote
0 answers
380 views

wpautop is not working when displaying content saved using wp_editor in a custom meta box

I am using wp_editor in a custom meta box. It is saving the content to the post metadata. And displaying it in the meta box as it should. The problem is when I am trying to display this content on ...
Amrit Ray's user avatar
1 vote
0 answers
603 views

Removing line breaks when in text view with wp_editor

While working on a custom plugin, I needed to add the wp_editor in the admin to let the user add its own content. I want the user to be able to write custom rich texts with the "Visual" editor mode ...
fraxool's user avatar
  • 121
-1 votes
1 answer
775 views

How to disable auto-p in WordPress?

I need to remove the "wpautop filter" from my WordPress Website because it is adding too many paragraphs. I'm new to WordPress. I don't know how to create Child themes. The name of my theme is the "...
Tope Leye's user avatar
0 votes
0 answers
289 views

Wordpress not saving <p> tags for custom taxonomy term description

I'm using wordpress API to display content. I'm using the classic editor since guttenberg is bugging out elsewhere. I noticed that if a paragraph does not have inline styles, wordpress does not save ...
geochanto's user avatar
  • 131
1 vote
1 answer
4k views

How to call a PHP function in WordPress when you click on a button?

How to process the textarea field with the standard WordPress function wpautop() when clicking the button? Here's the form: <textarea id="my_ta">Lorem ipsum!</textarea> <button id="...
Андрей Бочкин's user avatar
0 votes
1 answer
256 views

Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?

WordPress 5.2 destroys structured data by adding rel="noopener noreferrer" to widget output (also to shortcodes): How to display the shortcode output without code change? This feature was added in 5....
Blackbam's user avatar
  • 565
3 votes
1 answer
9k views

WooCommerce Description and Short Description <p> tags removal

When adding content into the description and short description fields for a product, line-breaks and tags are completely removed from the markup. Other than installing Advanced TinyMCE, is there any ...
macondo_buendia's user avatar
2 votes
3 answers
5k views

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="https://via.placeholder.com/64x64.png"]<h5>List-based media object</h5>Cras sit amet ...
endcoreCL's user avatar
0 votes
1 answer
313 views

Images that copy code to clipboard when you click on them

I run a website about a programming language which is very well-integrated with a front-end which adds a lot of styling to the code that cannot be replicated in the browser. For that reason, I publish ...
C. E.'s user avatar
  • 101
1 vote
2 answers
3k views

How do I disable wpautop for a specific block?

I've registered a custom editor block with Advanced Custom Fields (ACF), and am using render_template with a PHP template partial to display the block contents. Inside the template is some HTML (...
Morgan Estes's user avatar
  • 1,545
0 votes
0 answers
324 views

Understanding automatic text formatting in the Wordpress editor

Why does the text editor remove paragraphs and line breaks? Surely maintaining basic formatting such as paragraphs or line breaks is a basic requirement in all CMS systems. It's hard to believe that ...
Richard Tinkler's user avatar
2 votes
0 answers
551 views

Wordpress blockquote removes `<br>` tag

So I have a quote in my page template and I would like to give the user the opportunity to add line breaks whenever they desire to do so. I wanted the blockquote to have an extra <p> tag inside ...
Interactive's user avatar
  • 1,006
1 vote
1 answer
881 views

Remove wpautop from specific shortcodes only

I need to disable wpautop for some shortcodes. I've read the following on how to disable it: http://www.mstoicthemes.com/disable-wpautop-shortcodes/ https://customcreative.co.uk/resolving-wpautop-and-...
Toskan's user avatar
  • 524
0 votes
1 answer
229 views

wpautop filter off for pages but on for posts

I have the wpautop on remove filter for my pages but would like to turn it on just for posts and was wondering how to go about that. I'm newish to wordpress and can't figure out how to get this to ...
jessica mele's user avatar
0 votes
2 answers
2k views

remove_filter( 'the_content', 'wpautop' ); is not working for me

I use Tinymce Advanced plugin. I would like to remove p tag by adding this code remove_filter( 'the_content', 'wpautop' ); to my functions.php. However, it does't work. When I press ENTER, it still ...
Topy's user avatar
  • 163
0 votes
1 answer
623 views

Keep br tags from stripping

Is there some filter to disable this, sometimes awful feature? I need content of some custom post type to be displayed intact, with all of <br>s. To get the content I'm using get_the_content()...
Miloš Đakonović's user avatar
0 votes
1 answer
111 views

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 ...
Yazmin's user avatar
  • 327
0 votes
2 answers
542 views

Prevent Black Studio TinyMCE from adding <p> tags when switching from Visual to HTML mode

I'm having a really annoying problem with Black Studio TinyMCE Widget in Wordpress, wherein the plugin always adds paragraph p tags around any text, image, link, object when switching from Visual ...
user105038's user avatar
1 vote
1 answer
772 views

Extra paragraph tags in an enclosing shortcode

I have a shortcode to create columns, such that the page in the editor (text view) looks like this; [two-column]<ul> <li>Annual statutory accounts preparation</li> <li>...
Chris Pink's user avatar
-2 votes
1 answer
250 views

Can I prevent wordpress adding <p> and <br> tags to autoembeds

Cant give a reduced code example right not because my Advanced Responsive Video Embedder plugin is somewhat complicated. But the exact same code is used to generate the embeds, its just through ...
NextGenThemes's user avatar
0 votes
1 answer
2k views

How do I remove p tag *insertions*? Disabling `wpautop` removes manual tags

I am trying to post static pages with HTML content. So I need to disable wpautop, but when I do this my content is stripped of all <p> tags it has. I remove the wpautop filter from my header....
Josh C's user avatar
  • 273
2 votes
1 answer
77 views

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 ...
luukvhoudt's user avatar
1 vote
1 answer
877 views

Selectively remove empty line after line change

In WP post editor, how can I change lines without adding an empty line? I try to post this One line Second line third line But it always shows like this One line Second line Third line PS: I ...
IXN's user avatar
  • 916
7 votes
3 answers
8k views

New method to disable wpautop after WP 4.3?

After WordPress 4.3, the old method of disabling wpautop no longer works. Has anyone discovered a new method for removing this function? remove_filter( 'the_content', 'wpautop', 99 ); remove_filter( '...
C4talyst's user avatar
0 votes
1 answer
608 views

Is it a good practice to disable wpautop for premium themes?

I am Developing a WordPress Theme which have some shortcodes to display content. The problem I am having is, extra p elements are being added within shortcodes. I can disable wpautop with filter, ...
Abdul Awal Uzzal's user avatar
2 votes
2 answers
2k views

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 ...
EpF's user avatar
  • 121
1 vote
2 answers
1k views

<p> tag breaks shortcode output (other solutions don't work)

I just encountered weird problem. My shortcode output which is something like '<span class="link_container"><a href="#">'.$content.'</a></span> <div class="upgrade_box"&...
Igor Yavych's user avatar
0 votes
1 answer
883 views

ACF Shortcode bringing in my shortcode is adding unnecessary line breaks

At the VERY core, my question is - how to remove linebreaks on a single ACF field that is inserted with the ACF shortcode. I have a lot of "shortcodes within shortcodes" here so I will walk this ...
Aibrean's user avatar
  • 283
0 votes
0 answers
96 views

Inline style appears in the editor but breaks on live site

So there is a page with: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $desc= str_ireplace('"', '', trim(get_the_content())); ?> <?php ...
Laniakea's user avatar
  • 503
2 votes
0 answers
848 views

Wordpress editor strips out anchor tags when they appear on their own line

In the text below, when I toggle the WYSIWYG view from Visual to Text, the anchors are left intact. However, when I switch back to Visual, the anchors are replaced with &nbsp; elements. This is ...
N2Mystic's user avatar
  • 3,193
1 vote
0 answers
141 views

TinyMCE strips breaks inside editor

the posts are shown correctly in the frontend. But when i go to edit, the content inside tinyMCE is without breaks ?! So i have to copy my content from frontend and paste it to the editor every time i ...
Yannick Schuchmann's user avatar
0 votes
2 answers
6k views

Remove p tags in wordpress posts

WORDPRESS VERSION: 3.8.1 PHP version: 5.3 I have a trouble with wordpress posts. How can I remove the auto P tags added? This is my final html code: <div class="one_half_style_4_last"> <p&...
Francesco Craparo's user avatar
0 votes
1 answer
3k views

Wordpress remove filter wpautop not working

i have a trouble. I tried to use too many plugins and funciont and also remove_filter( 'the_content', 'wpautop' ); but it is not working. I've added a shortcode into a text widget but wordpress add ...
Francesco Craparo's user avatar
2 votes
1 answer
2k views

basic shortcode - Why 1st paragraph not wrapped in p tag, but 2nd is

I'm working on a basic plugin that adds shortcodes for columns, buttons, panels, ect. Nothing new here. I haven't altered wpautop in anyway; I've tried removing it and delaying it - no change. What ...
gstricklind's user avatar
1 vote
1 answer
5k views

How to remove p tags around img and iframe tags in the acf wysiwyg field

I am querying an advanced custom fields wysiwyg field. Problem is in the output wordpress wraps occasional imgs and iframes with p tags no matter what i try. Deactivate the wpautop works remove_filter ...
rkoller's user avatar
  • 634
0 votes
1 answer
3k views

remove and then add wpautop

I'll start by saying yes, I searched, and yes, I found an answer to this question. It's basically the solution I came up with but I want to make sure this isn't a bad solution. Here's the real ...
Thrillho's user avatar
  • 125
1 vote
0 answers
193 views

get wpautop to not wrap tags but only text

Is it possible for wpautop to only wrap plain text, so that e.g. here: text <a href="">link</a> only the "text" gets wrapped. Why would you want to wrap tags anyway? Maybe anyone has a ...
br4nnigan's user avatar
  • 391
22 votes
3 answers
6k views

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 ...
Thought Space Designs's user avatar
1 vote
0 answers
128 views

Make WP not format code, not insert line breaks in between tags

Gahhhh! Are you kidding? Ok, I guess wp wants my source code all nice and formatted... <a href="/asdf">i'm a link</a><ul><li>list item</li></ul> becomes <p&...
Doug Cassidy's user avatar
0 votes
1 answer
215 views

How do I format my custom html so wpautop won't try to reformat it?

I've got a desktop app that generates html for my customers to paste into their WP pages/posts. Nothing fancy just some image tags, hyperlinks and simple inline css. How do I preformat that code so ...
Chris's user avatar
  • 1
1 vote
3 answers
1k views

Wordpress stripping out BR tags, need assistance

Im having a problem where WP for some odd reason is stripping out my BR tags. Ive looked online and have read a few solutions that people offered including the installation of TinyMCE advanced plugin ...
somdow's user avatar
  • 265
1 vote
1 answer
5k views

Removing unneccessary p-tags (Not every p)

I removed wpautop from my theme: function disable_linebreaks($content) { remove_filter ('the_content','wpautop'); return $content; } add_filter('the_content','disable_linebreaks',1); ...
Sebastian Starke's user avatar
0 votes
1 answer
372 views

Custom Field add markup to line breaks

I am looking for a solution to add markup to a custom field with multiple lines. Much like wpautop, but with customization. I'm not quite sure to approach this with a custom function or something ...
mediaryte's user avatar