On December 21, 2019, I learned...

How to Exclude Post Categories from a WordPress Loop

/** Exclude "Today I Learned" category from blog loop */
function exclude_category_posts( $query ) {
  if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( 'cat', '-5' );
}
add_action( 'pre_get_posts', 'exclude_category_posts' );
(Updated on 11/23/2020)