I've previously been able to search & replace using the very helpful "Search & Replace" plugin for wordpress but now i've came across a problem i cannot solve.

In table wp_posts i want to replace the following:


<div id="postbottom">


</div><div id="postbottom">

No matter how i input the search string i get 0 results, how do i search & replace when the string contains a newline? I've tried strings such as

</div>\n<div id="postbottom">

but this has yeilded no results.

The possibility would perhaps to execute a query directly in the sql database? How would i go about forming such a complex query to search based on a string that contains a newline? Is it possible?

1 Answer 1


that was easy to do directly in sql:

UPDATE wp_posts 
SET post_content = replace(post_content,'</div>\r\n\r\n<div id="postbottom">','</div><div id="postbottom">');

Your Answer

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

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