admin管理员组

文章数量:1122846

My client has loaded about 500 products into Woocommerce, but has inadvertently pasted in a stack of extra tags into the product description- divs and spans etc like below:

<div class="summary entry-summary">
Colours – Blush, Burgundy, Dusty Rose, Mauve, Navy, Sage
Sizes- XS- 3XL
</div>

What would be the easiest way to strip everything except for the plain text content and resave the "cleaned" product description?

I've tried the solution suggested over at Filter/Remove HTML Elements on all posts and pages but it did not seem to do anything.

My client has loaded about 500 products into Woocommerce, but has inadvertently pasted in a stack of extra tags into the product description- divs and spans etc like below:

<div class="summary entry-summary">
Colours – Blush, Burgundy, Dusty Rose, Mauve, Navy, Sage
Sizes- XS- 3XL
</div>

What would be the easiest way to strip everything except for the plain text content and resave the "cleaned" product description?

I've tried the solution suggested over at Filter/Remove HTML Elements on all posts and pages but it did not seem to do anything.

Share Improve this question asked Apr 19, 2019 at 0:05 warm__tapewarm__tape 611 silver badge11 bronze badges 1
  • the easiest way would be to delete and then reload the corrected data. Other than that you could run an sql query and get rid of them all. – rudtek Commented Apr 19, 2019 at 15:17
Add a comment  | 

1 Answer 1

Reset to default 0

If there aren't any CSS classes with the names of those spans, then there is no need to remove them, as they won't change the visual look of the output.

But there are Search and Replace plugins that will do that for you. (My favorite is "Search and Replace Plugin". ) You would just need to be very careful in how you specify the search string, So a backup of the database is really important.

If you want to remove all 'spans', for example, there are regex expressions that you can use. They are quite specific, and regex is not easy, but there are lots of googles (or bings or ducks) to help you with the process.

You can also use phpMyAdmin to directly interface with the database. That requires a bit more experience; you didn't mention your level of experience.

And again, backups of the database before you start is important. You might even clone the site to 'practice'.

本文标签: functionsStrip all HTML tags from product content and resave