Skip Navigation

[Resolved] Unwanted p and a tags showing on view and archives despite [wpv-noautop]

This thread is resolved. Here is a description of the problem and solution.

Problem:

The user is experiencing unwanted paragraph tags (

) being added automatically to the content rendered on the front end, causing discrepancies between the content template and the displayed output.

Solution:

To prevent WordPress from adding automatic paragraph tags (

), add the following code to the functions.php file of your theme:

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

This code disables the wpautop function for both post content and excerpts.

Relevant Documentation:

https://developer.wordpress.org/reference/functions/wpautop/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 1 voice.

Last updated by Christopher Amirian 2 weeks, 4 days ago.

Assisted by: Christopher Amirian.

Author
Posts
#2787990
Screenshot 2024-12-12 at 8.47.38 PM.png
Screenshot 2024-12-12 at 8.46.21 PM.png

I am trying to: have the front end show exactly what I have in my content template.

Link to a page where the issue can be seen:
hidden link (view on bottom of post)
This post uses the product content template inside of a view that is build in the block editor.

and hidden link (woo product archive)
This page uses the product content template inside of a product archive built in the block editor.

The product content template (same for both) is currently done in the classic editor because last time I tried to recreate it in the block editor all the features I needed were not available/working.

I expected to see: exactly the same code as I put on the back end

Instead, I got: extra paragraphs added, including an extra paragraph with a duplicated a tag inside it. Attached images show minified HTML from the content template vs what shows on front end. Three extra p tags marked in red. Code is wrapped in the no auto p shortcode and paragraphs are set to manual.

(Maybe related to https://toolset.com/forums/topic/for-nigel-unwanted-tags-added-to-view-output/?)

All plugins deactivated except Toolset Types, Toolset Blocks, Toolset Woocommerce Blocks, Woocommerce. Theme is Astra.

#2788405

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support.

Would you please add the code below to the functions.php file of your theme to disable the wpautop feature?

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

I have found the code from WordPress website:

https://developer.wordpress.org/reference/functions/wpautop/

Thanks.

#2788886

Hello Christopher,
did what above but nothing changed, this autop thing is quite annoying particularly when there is a Field & Text inside a loop, and output becomes longer than needed.
Regards

#2789012

Christopher Amirian
Supporter

Languages: English (English )

Hi,

This is a ticket reserved for the original poster. I'd appreciate it if you could create a new Toolset support ticket using the link below and provide enough context and login information for further investigation for your case:

https://toolset.com/forums/forum/professional-support/

Thank you.