-
Find out the ID of the category that you want to assign. You’ll see it in the URL when editing the category (URL will be something like
?taxonomy=category&tag_ID=3&post_type=post
, here 3 is the ID) -
Assuming that the ID is 3, you can now run this query in your database (eg via PHPMyAdmin)
INSERT IGNORE INTO wp_term_relationships (object_id, term_taxonomy_id) ( SELECT DISTINCT ID, 3 FROM wp_posts WHERE post_type="post" AND post_status="publish" );
If you use a different prefix than wp_
, be sure to change it. Also change the 3 to the ID you want.