how to delete completed orders in woocommerce using a my sql query

后端 未结 5 862
慢半拍i
慢半拍i 2021-01-03 08:02

I want to delete completed all orders in woocommerce by using a single my sql query. Because, I\'m having a problem with my WordPress Dashboard

5条回答
  •  自闭症患者
    2021-01-03 08:42

    I solved this by first setting all the relevant orders to trash:

    UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order';
    

    If you have too many posts to get through when pressing Empty Trash and you get a PHP error, you can run the following SQL to remove them instead:

    DELETE FROM wp_posts
    WHERE post_type = 'shop_order' 
    AND post_status = ‘trash’
    

提交回复
热议问题