网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

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

GG网络技术分享 2025-03-18 16:12 4


问题描述:

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

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~

功能建议

我设置了一个新的cdn来提供图像 cdn.example.net </ code>。 所有我的新上传工作正常,但我的旧图像有路径 example.net </ code>。 </ p>

我尝试使用 WP_CONTENT_URL </ code>来更改图像,但它反映在插件中,主题文件要被破坏。 所以我需要上传我的所有插件,主题文件[这不是一个很好的选择,因为我需要安装的每个新插件,我需要上传它的文件]。 </ p>

我尝试使用SQL UPDATE wp_posts SET post_content = REPLACE(post_content,\'http://example.net/blog\',\'http://cdn.example.com。 net\'); </ code>。 它告诉我行匹配</ code>但没有行受影响</ code> </ p>

</ div>

网友观点:

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\' );

标签:

提交需求或反馈

Demand feedback