Use SQL statements to modify WordPress article content in batches to make your operations more efficient

Recently, some article data on the website needs to be replaced, but the number of articles is too large. If you want to change the data in the fastest way, you can only log in to the WordPress database background to make batch changes. Enter the background of the website, open or log in to your database, and select the appropriate field to search and replace according to the content you want to replace.

Steps:

1. Log in to the phpMyAdmin panel and find the database that needs to be operated;
2. Find and click the SQL option in the menu bar;
3. In the SQL statement input box, enter the SQL statement you want to execute;
4. After entering the SQL statement, click "Execute";

WordPress batch modify/replace post content
SQL statement: UPDATE wp_posts SET post_content = replace(post_content, 'old content', 'new content');

WordPress batch modify/replace post summary
SQL statement: UPDATE wp_posts SET post_excerpt = replace(post_excerpt, 'old content', 'new content');

WordPress batch modify/replace post author
SQL statement: UPDATE wp_posts SET post_author = original author id WHERE post_author = new author id;


WordPress batch modify/replace sensitive word SQL statement in comments : UPDATE wp_comments SET comment_content = REPLACE( comment_content,'sensitive word','***');

Delete according to nickname:
SQL statement: DELETE FROM wp_comments WHERE comment_author = 'nickname';

Delete
the SQL statement according to the URL link: DELETE FROM wp_comments WHERE comment_author_url LIKE '%www.baidu.com%';

Delete the SQL statement according to the email of the commenter
: DELETE FROM wp_comments WHERE comment_author_email ='[email protected]';

Guess you like

Origin blog.csdn.net/winkexin/article/details/131838097