Last update at :2024-05-07,Edit by888u
If you plan to replace and modify the same text scattered in a large number of WordPress articles, and manually editing the articles and modifying them requires a lot of work, you can use the following code to implement batch replacement. The WordPress operating data constant $wpdb will be used to modify the database, and no login is required. Database operations.
Batch replace text in articles
Add the code to the end of the current theme function template functions.php:
global $wpdb; $wpdb->query("UPDATE wp_posts SET post_content = replace( post_content, 'old text', 'new text' )");
To modify the text, if there are multiple paragraphs of text, just copy a few more pieces of code, add them to functions.php, and delete them after use.
It also supports replacing links in articles.
Tip: Operating the database is risky, please make a backup in advance!
Recommended site searches: free trial of virtual space, domain name registration with the Ministry of Industry and Information Technology, Internet cafe IP address query, domain name registration query, asp free space application, Taiwan server, overseas host rental, Japanese server free, domain name registration service, website registration information query, < /p>
发表评论