You can use pre_get_posts
Exclude categories on your main page
function exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-1,-1347' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
Related Posts:
- Category links suddenly started giving 404 errors
- Any way to assign Post Categories and Tags to Links?
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- How to enable category hierarchy for links?
- Combining post categories and link categories?
- Displaying a full post instead of a slug per category?
- Link Attachment Image to Category
- Class active for Archive link – looped out
- Why do my categories redirect?
- Get category url in loop
- Older entries link within category page
- Style category link depending on category ID
- Get paged category link programmatically
- Link To Child Category For A Post
- Link from navbar to categories
- javascripts files not linking to my category slugs?
- wp_insert_link not working
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- Show Subcategory Name Instead of Parent Category
- Link For Portfolio Categories
- How to get the link of all categories
- Featured image for links and categories
- Categories as selectable links on submission form
- Displaying categories and subcategories without link
- How to get category slug link? ( include parent categories)
- Can I set a default featured image for a category?
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Could not insert term into the database
- Activate Gutenberg in category-descriptions
- How to show subcategories in categories else show posts
- What’s the URL for a category archive?
- Weird behaviour when adding terms/term_taxonomies programmatically
- How can I get category ID by category name?
- How would I increase the Author Role to be able to add a new category?
- How to remove the parentheses from the category widget
- Filter front page posts by category
- Randomise results from a category page?
- How to get the url to tag & category base set by the user?
- Multiple level category drop-down
- get_category_link() is returning nothing
- Adding Custom User Profile data based upon Categories
- Only show category to certain user levels without plugin
- How to: 301 Redirect /category/ to /customname/
- Custom Query to search through categories
- Root level category, tag, author and archive pages to work
- Order posts by category name
- How can I make wp_list_categories output li with category-slug as class, for its children?
- Get sticky post from category?
- Display one latest post from multiple categories
- Archive pagination causing 404 with permalinks structure
- Remove word “Category” from WooCommerce product page [closed]
- Get a list of Terms for a specific category
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Output link to category from WP_Query loop of woocommerce products
- How Do I Merge Categories With phpMyAdmin
- Display name of the last child category
- Password protect a specific category page/post
- Edit the markup of categories list
- Show category children, one level
- a-z list, categories and sub categories in loop
- Category slug $_SERVER[‘REQUEST_URI’];
- If in category to be inside of a function
- How to exclude posts from a category when using this particular format
- Viewing category pages without the word ‘category’ in URL
- wp_dropdown_categories and custom taxonomy + custom post type
- Different excerpt styles per category, but chronological
- Show only one category
- Pagination Not Working on Category.php page
- How to view WordPress’ default category IDs?
- Random taxonomy category list
- Filter Home Page Posts in Buddypress [closed]
- Broken category pagination
- Linking products to categories
- Color different for the current category
- Linking to the most recent post in a Custom Post Type
- how to change template?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- Show all posts for a specific category/author
- Hard coded main navigation
- Resort get_categories
- How to call custom category field data in theme?
- Query Posts Exclude Entire Category
- one category template for multiple categories
- Display posts separated by Category in Author’s page
- One Specific Category To Permalink
- Hide woocommerce category name from specific pages
- How can I define a custom archive for childs of a specific category?
- WordPress category widget only show categories with children
- How do I toggle pagination on/off in search results and category listings via a link?
- Category shows only top level child categories
- The arrangement of categories always change while posting article
- Woocommerce custom category page with pagination [closed]
- Menus don’t work after 4.4 [closed]
- List categories with custom code
- Custom post and category template pagination problem
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing
- WordPress portfolio how to change “ALL” category by one other category that I created?
- How to hide my categories pages’ names, and how as well to reduce the space beween my sidebar’s widgets?
- Keeping posts in Categories
- Different number of posts in regular loop and CPT category page