function exclude_category_home( $query ) { if ( $query->is_home ) { $query->set( 'cat', '-5' ); // change the number for your cat ID } return $query; } add_filter( 'pre_get_posts', 'exclude_category_home' );
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter