How to batch delete all articles in a specified category in WordPress

888u

Last update at :2024-02-06,Edit by888u

Many friends are using wordpress to build websites, and they will also collect some data. If there is a problem with the data you collected, we want to delete articles under a certain category. If thousands of articles are deleted manually in the background, it will be very slow. Yes, today I will share a method of deleting directly in the database. One thing you need to pay attention to is to make sure that the prefix of your data table is "wp_". In addition, remember to back up before execution. Be sure to back up, because you don't know when it will happen. Something went wrong.

SQL is as follows

Delete articles in the specified category

delete from wp_posts using wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.id = wp_term_relationships.object_id and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id and wp_term_relationships.term_taxonomy_id = 18 (taxonomy ID)

Delete category

delete FROM `wp_term_relationships` where term_taxonomy_id = 18 (category ID)

Recommended site search: how to buy virtual host, how to check domain name registration number, Hong Kong cn2 server, php hosting space, icp registration query network, this website server is in the United States, registration-free jsp space, Ministry of Industry and Information Technology icp registration, server in the United States, Mobile server hosting,

How to batch delete all articles in a specified category in WordPress

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码