Home > Net >  Remove all <div> tags with a query
Remove all <div> tags with a query

Time:02-16

I want to remove all <div> tags from content, I use this query and it removes only <div> tags with no class, how to remove all <div>,<div class"example">,</div> ?

UPDATE wp_posts SET `post_content` = REPLACE (`post_content`, '<div>', '') WHERE `ID`=84259

I want a query that removes <%div%> (% means no mater what is before and after div)

CodePudding user response:

You can use REGEXP_REPLACE:

update wp_posts
set post_content = REGEXP_REPLACE(post_content, '</?div.*?>', '');

Fiddle

  • Related