Removing ‘Uncategorized’ from Categorized WordPress Posts (using SQL)

WordPress Playlist: https://www.youtube.com/playlist?list=PLErU2HjQZ_ZMbDcpXu5EcR4yOkHFh_l7F

Query to remove ‘uncategorized’ from categorized posts
DELETE FROM wp_term_relationships WHERE term_taxonomy_id=1 AND object_id IN ( SELECT object_id  FROM ( SELECT tr.object_id FROM wp_term_relationships tr, wp_term_taxonomy tt WHERE tr.term_taxonomy_id=tt.term_taxonomy_id and tt.taxonomy='category' GROUP BY tr.object_id HAVING COUNT(*) >1 ) as temp_table);

Leave a comment

Your email address will not be published. Required fields are marked *