XF 1.4 Mass replacing text in posts


I recently changed domain names and we have some posts that use the old forum domain name. How would I go about doing this? Through sql queries?

I've tried using Post Content Find / Replace 1.0.0 but the amount of posts that it needed to replace was too large and it ended up freezing mysql and server.

Thanks for reading!


Thanks @Brogan, is there a way to do per node or thread? Would the server freeze up if I did that through phpmyadmin? Around 60k threads would need updating

I found another post of yours regarding updating prefixes, could you tell me if this would work?

UPDATE xf_post SET where node_id in (9,15,18) message = REPLACE(message,'current_content','new_content');


XenForo developer
Staff member
In theory you can do it but it's much more complex than that since the node isn't part of the post.

If you have a large forum, it may be worth closing the forum when running the query, but otherwise it may take some time, but it should work.

Please take a backup before running any queries like that. It can't necessarily be undone.


I ran the query successfully, but I noticed some (not all) threads still show the old content, but when I click edit for the post with the old content it automatically changes back to the new content name. Not sure what to do now, I thought the next thing I should do is to rebuild posts but there isnt an option for that.

What should I do?

Thanks for the help! @Mike @Brogan


Thanks @Brogan that sorta did it. When I have bb code disabled all posts were replaced with the new content but when I enabled it again, some posts still had the old content but less than before. I'm running maxcdn as well so I'm assuming that may be causing it.

Anyhow, the amount of posts that had incorrect info was small so I just ended up manually editing each one.



Well-known member
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');
I have some issue Brogan.
I want to replace:

Old content: ’
Correct character: '

Here's my query:
UPDATE xf_post SET message = REPLACE(message,'’',''');

But I got an error:
Static analysis:
1 errors were found during analysis.
  1. Ending quote ' was expected. (near "" at position 60)


Active member
Is it safe to run a similar query to update the message field where user id = 42424242 on a database with 3 million+ posts? We want to remove all instances of "replace 7" in a certain users posting history.

UPDATE xf_post SET message = REPLACE(message,'replace 7','') WHERE user_id = 42424242