Search and replace in post content

I am about to change themes on my site and also a plugin that creates tabs with a post.

I need to replace multi-line text with other multi-line text and can’t work out how to do it.

I have tried “/r/n” but that doesn’t seem to work.

Here is an example:

I need to replace

[tabs]
[tab title="1024x576"]
<table class="screenshot-table">

with

[tabby title="1024 x 576"]
<table class="screenshot-table tentwentyfour">

Here is an example of what I have tried:

update wp_posts set post_content = replace(post_content, '[tabs]/r/n[tab title="1024x576"]/r/n<table class="screenshot-table">', '[tabby title="1024 x 576"]/r/n<table class="screenshot-table tentwentyfour">');

TIA
Phillip

1 Answer
1

Okay, this always seems to happen to me. I spend ages looking for an answer and finally decide to give up and post here and then one more search finds enough to solve it.

Anyway, this is what worked for me:

update wp_posts set post_content = replace(post_content, '[/tab] 
[tab title="1024x576"]
<table class="screenshot-table">', '[tabby title="1024 x 576"]
<table class="screenshot-table onetwentyfour">');

Simply by putting the multi-line text ON multi-lines worked.

You learn something everyday!

Leave a Comment