Per cancellare in blocco alcuni prodotti di un ecommerce WooCommerce
:parent_category è l'identificativo numerico della categoria che contiene altre categorie
Guarda come fare pulizia in un database Wordpress.
Prima fai sempre un backup!
SET autocommit = 0; START TRANSACTION; DELETE pm.* FROM wp_postmeta AS pm WHERE pm.post_id IN ( SELECT tr.object_id FROM wp_term_relationships AS tr JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.parent = :parent_category); DELETE p.* FROM wp_posts AS p WHERE p.id IN ( SELECT tr.object_id FROM wp_term_relationships AS tr JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.parent = :parent_category); DELETE tr.* FROM wp_term_relationships AS tr JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.parent = :parent_category; COMMIT; SET autocommit = 1;
:parent_category è l'identificativo numerico della categoria che contiene altre categorie
Guarda come fare pulizia in un database Wordpress.
Commenti