Assuming this is the default main query, see the example for pre_get_posts
, which shows how to exclude a category from the main query:
function wpa78465_exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-1,-1347' ); // IDs of categories to exclude
}
}
add_action( 'pre_get_posts', 'wpa78465_exclude_category' );
Related Posts:
- How to exclude categories from recent posts, recent comments & category widgets?
- How can I exclude a particular category from my WordPress Page 1 and Page 2?
- exclude category from get_posts?
- Exclude the category from the WordPress loop
- Exclude certain category from latest updates
- Exclude categories from Loop, queries, widgets, post navigation
- List posts by category exclude current post
- wp_list_categories exclude not working
- Optimal way to redirect home page to category archive?
- How to Set an Individual Homepage for Each User?
- Excluding a category from next and previous post links
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- Exclude a category from the filed under list only on some templates
- display woocommerce all category title on home page
- How to exclude posts from a category when using this particular format
- Exclude category from Tag Template
- exclude post from displaying in loop if it is in a category, but not in many categories
- I need to create a search form that will display search results from specific category
- Exclude Posts From Specific Category from Next and Previous post links
- Query Posts Exclude Entire Category
- exclude categories from search results
- Exclude category from fucntion
- WordPress category widget only show categories with children
- wp_list_pages() exclude category
- Loop doesn’t exclude the specified category in home page
- Exclude category from query
- Functions.php: Exclude Category from “Blog”
- How to Link to Most Recent Custom Post of Same Term
- Posts from a category on homepage with category archieves page default css
- Woocommerce filter function not updating
- List recent posts with link to first category
- wp_list_categories not excluing multiple ids
- How to exclude posts from category posts count
- Exclude category from foreach loop
- Have posts that belong to multiple categories, exclude some categories from homepage
- Exclude all subcategories in the_category (post)
- I need to exclude from a query a category and a few custom taxonomies
- Shows only one Category in home page
- Exclude categories by ID
- Exclude the category in WordPress
- How can I exclude a category from the main loop with the category name & not ID?
- User level categories
- Exclude category from drop down list form
- exclude certain categories form archive widget
- pagination 404 error, same slug home and categories
- How to remove an item from a custom Walker_Nav_Menu
- Exclude a category and post_type from wp_query
- Linking to the most recent post in my podcast category
- Exclude category from WP_Query args not working
- Displaying Category in sidebar post widget but not in the loop on home
- Category menu that filters out empty categories
- Display last postings of 5 categories on homepage
- How do I get a single page navigation depending on the previous page?
- Problems with explode [closed]
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- How to have a category not show up in query post with page panigation?
- Duplicate homepage to show posts from 1 category
- Customize category query in widget
- Call function on a single page
- Country Ways Content Show
- Excluding cateory not working on my site. how to solve this? [closed]
- How to define category ID in an array?
- Elegant way to add parent categories?
- List Categories of the Parent Category of the Current Category
- Link each category to last post
- Auto add pages to category menu
- Get term by slug in Gutenberg
- Show only first children level of current category?
- How do I automatically put categories and their descriptions on a WP Page?
- Taxonomy filter all children
- RSS/XML of all Categories and/or Tags
- How do I get rid of “category” from my URL structure?
- Have different permalinks based on category
- How do I output all category with custom field?
- Add /category/ to an author archive page
- Remove subcategory and category with some rules from permalink
- How to remove specific categories from posts?
- how to get full category path including parent and subcategories
- Categories are not listing their respective products
- Two columns in homepage each with one category
- Pagination on category.php and tag.php not working
- How do I attach a page to a category similar to how we attach media to a post?
- Adding a block with query in homepage
- multiple values in an array for category__and does not work with WP_Query
- get all categories’ latest post in one query
- Categories show 404 error on multisite installation
- Get Categories of multiple posts
- Show subcategories broken when WP/WC updates
- Display menu in category and sub category
- Show alternative menu based on page template AND post category
- On main page, in each post, display image depending on post category
- Custom file with special code of category widget
- Using categories and pages in menus
- Gettind 404 not found wen click the view button for a given category custom post type portfolio
- list first post of Child Category on Category page
- Use get variable when rewritten url in wordpress
- Back to category link
- Custom Woocommerce Category view
- Show thumbnails 1-12 of category x on any given page
- Add Input Form for Select Category Like Tags