Exclude posts from specific categories
If you want your posts not to be linked to posts in specific categories, you can use the following snippet.
The above example excludes posts in categories with ID’s 100, 200 and 300. You should change this to the ID’s of the categories you wish to exclude. Enter the ID’s separated by comma without a trailing comma.
Note that this snippet only works for linking posts to posts and only works with the default category. You’re free to edit it to make it work on your custom post types and custom taxonomies of course!