database - A query to substitute images paths in gutenberg (website migration)?

I was used to do something like update wp_posts set post_content = replace(post_content,'', '');This

I was used to do something like

update wp_posts set post_content = replace(post_content,'', '');

This seems not to work anymore for texts that come from Gutenberg.

Any idea/update for this?

I was used to do something like

update wp_posts set post_content = replace(post_content,'http://dev.example/website', 'http://www.website');

This seems not to work anymore for texts that come from Gutenberg.

Any idea/update for this?

Share Improve this question asked Oct 23, 2019 at 18:14 Luca ReghellinLuca Reghellin 1,6422 gold badges21 silver badges45 bronze badges 1
  • 1 The Block Editor still keeps image URLs in the database, so if your query was working before, the editor isn't the reason it's not working now. Maybe your database has grown too large for the one query affecting every single post to run? You could try doing it in batches instead of every single post at once, i.e. include a WHERE "ID" < 100 clause. – WebElaine Commented Oct 23, 2019 at 18:45
Add a comment  | 

1 Answer 1

Reset to default 0

I just found out the reason. It's because I'm using ACF Pro as Blocks. The data will be written in database in json format, and the urls will escape all the slashes ad double quotes. So for example

src=\"http:\/\/dev.example\/website\/wp-content\/uploads\/2019\/10\/identity.jpg\"

So I should add a row like this:

update wp_posts set post_content = replace(post_content,'http:\/\/dev.example\/website', 'http:\/\/www.website');

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745057216a4608740.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信