Modified the permalinks of some articles on the site. Is there a way
to modify all related links within the site? The answer is yes.
For batch replacement in the WordPress database, we can adopt the following two methods:
- Use a Plugin for Batch Replacement
- Use Database Commands for Batch Replacement
Replacement Method 1: Use the Better Search Replace Plugin
Better Search Replaceis a batch search and replace tool for databases
WordPress Plugin. The plugin is in English, but it's very simple to use. The specific steps are shown in the image below:

- Enter the content you want to search for in the 'Search for' field
- Enter the content you want to replace with in the 'Replace with' field
- Select the tables to search and replace in 'Select tables'. The table for WordPress posts is wp_posts
- 'Case-Insensitive?' determines whether to be case-sensitive
- 'Replace GUIDs' refers to the website domain's GUID. It is generally not selected.
- 'Run as dry run?' If checked, it will not write directly to the database; it will only show you how many changes would be made. If you want to make the changes, uncheck this box.
A simple example. For example, if your previous article URL structure was https://blog.naibabiji.com/archives/*.html and the new URL structure is https://blog.naibabiji.com/skill/*.html, then you only need to fill in '/archives/' in 'Search for' and '/ji-qiao/' in 'Replace with'.
Official Website Download Cloud Storage DownloadReplacement Method 2: Use Code to Replace in the Database
This method requires using phpMyAdmin to operate on the database. If you are not familiar with database operations, it is recommended to use the plugin from Method 1 for modifications. The implementation is the same; this one uses command-line modification, while the plugin uses a graphical interface. After opening phpMyAdmin, enter your website's database and execute the following SQL code.
UPDATE wp_posts SET post_content = REPLACE(post_content, '原内容' , '替换为的内容');
WordPress Batch Content ReplacementIt is typically used when we have changed the website URL structure, or when you have modified the URL of an important article and need to batch update links referencing that URL in other articles. However, URLs written in your website's theme template files cannot be replaced using this method; only data within the database can be replaced using the methods above. For safety, it is recommended to back up your database before performing any replacements.
Using a Plugin to Backup WordPressMore Methods for Batch Processing WordPress Data
If you need to batch clear articles, featured images, media library data, etc., under a WordPress category, please refer to the tutorial article below:
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.