I have content where the paragraphs are all messed up since the WordPress visual editor doesn't work well with pre-existing markup.

I would therefore like to remove the paragraph tags, while leaving the bullet points, hyperlinks and bold formatting, so that I can re-import my content and then hopefully space it out with the visual editor manually.

What is the best way to do this?

1 Answer 1


(obviously) untested, and make a backup of your DB first...but you ought to be able to do this natively in SQL:

UPDATE wp_posts
SET post_content = REPLACE(post_content, '<p>', '')
WHERE (put whatever selection logic you want here...)

Do the same for </p>. Like I said...make a backup first...

(edit) geez, didn't realize this was a year-old question...sorry, for some reason it was edited and at the top of the active questions list...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.