Home > CMS Tutorial > WordPress > How to batch replace custom column values ​​in WordPress

How to batch replace custom column values ​​in WordPress

藏色散人
Release: 2020-02-05 15:52:20
forward
3044 people have browsed it

The following tutorial column of WordPress will introduce to you how to batch replace WordPress custom column values. I hope it will be helpful to friends in need!

How to batch replace custom column values ​​in WordPress

Add the following code to the current theme function template functions.php Finally:

global $wpdb;
$wpdb->query("UPDATE wp_postmeta SET meta_value = replace( meta_value, 'https://www.baidu.com/','https://down.baidu.com/')");
Copy after login

The above example is suitable for modifying only the domain name in the link address, not Modify the link behind the domain name.

For example: https://www.baidu.com/2020/01/file.zip

is replaced with: https://down.baidu.com/2020/01/file. zip

Others can be deduced by analogy.

After adding the code, refresh the web page and the replacement is completed.

Please back up your data before operation, just in case!

After replacement, please remove the above code.

The above is the detailed content of How to batch replace custom column values ​​in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template