dsfphczao23473056 2019-05-02 07:38 采纳率: 100%
浏览 58
已采纳

更改wordpress旧图像路径url不会使用SQL反映在我的数据库中

I have set a new cdn to serve images cdn.example.net . all my new uploads works fine with it , but my old images has path example.net .

I tried to use WP_CONTENT_URL to change images but it reflects in plugins,themes file to be broken . so I needed to upload all my plugins,themes files [That's not a good option as every new plugin I'll need to install , I will need to uploads it's files ] .

I tried using SQL UPDATE wp_posts SET post_content = REPLACE (post_content,'http://example.net/blog','http://cdn.example.com.net'); . it tells me that there is row matched but with no rows affected

  • 写回答

1条回答 默认 最新

  • dp5657087 2019-05-30 13:24
    关注

    I managed to solve this issue by editing my wp-config.php

    First one will change all [Images,Plugins,Themes] path to another url , your cdn as an example

    define( 'WP_CONTENT_URL', 'your_cdn_website_url/wp-content' );
    

    I left this url so old one so plugins won't be broken

    define( 'WP_PLUGIN_URL', 'your_website_url/wp-content/plugins' );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?