Skip to content

eli5wp

  • code snippets

exclude categories from blog

June 14, 2021 by emily sparkle
// exclude categories from blog
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', '-63' , '1' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );
Categories code snippets, wordpress
Post navigation
gp featured post excerpt length
use images from live site on stage

categories

  • code snippets (57)
    • admin (8)
    • child theme (1)
    • css (9)
    • elementor (1)
    • generatepress (10)
    • htaccess (4)
    • woocommerce (17)
    • wordpress (15)
  • links (4)

topics

admin email cache chrome only comments exclude font awesome google analytics google fonts hacky optimization posts reset responsive shortcode text wp-show-posts

recent

  • woocommerce button color control
  • // GeneratePress Search Box Clear
  • Google API Console
  • DKIM Authentication
  • dreamhost cache settings
© 2022 ASPIRE