最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp autop - WooCommerce Description and Short Description <p> tags removal

matteradmin8PV0评论

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 setting, filter, or hook I need to check to make these fields include

elements.

In review of the Product object array in WooCommerce, it looks like the value for description is wrapped in the wpautop() function, but it doesn't appear to be working (it's possibly I'm just not understanding this part of the code correctly within the plugin).

Any ideas on how to force paragraphs into short/description content in WooCommerce?

Note: I only have ACF and WooCommerce installed as plugins. I'm using Underscores as a parent theme to build my own custom theme and product templates.

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 setting, filter, or hook I need to check to make these fields include

elements.

In review of the Product object array in WooCommerce, it looks like the value for description is wrapped in the wpautop() function, but it doesn't appear to be working (it's possibly I'm just not understanding this part of the code correctly within the plugin).

Any ideas on how to force paragraphs into short/description content in WooCommerce?

Note: I only have ACF and WooCommerce installed as plugins. I'm using Underscores as a parent theme to build my own custom theme and product templates.

Share Improve this question asked Mar 30, 2019 at 17:48 macondo_buendiamacondo_buendia 1051 silver badge8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 6

So, I realized I was using the actual object in the template to call the description $product-get_description(). If you're experiencing this issue, then you can wrap this in a wpautop(), or you can do what WC actually does (not sure how I didn't remember) and use the simple the_content() function to get the description. That will wrap any line breaks in your the editor with <p> tags if you want them.

Post a comment

comment list (0)

  1. No comments so far