In your functions.php file, use pre_get_posts
and swap out the -1 in the following code with the category I.D you want to exclude from your posts page.
function exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-1' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
Related Posts:
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Single.php – Get Current Parent Category
- Excluding posts not working
- Loop doesn’t exclude the specified category in home page
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- How to get post with slug and exclude categories
- How can I create a ‘sub-blog’ which has its own sidebar on individual posts?
- Excluding category from post navigation in WordPress?
- Get posts from category from custom query
- Edit Posts Page but not category specific pages?
- Exclude a ‘portfolio’ custom category?
- Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
- Change Post Title For Specific Category
- Display selected categories onto post page
- How to call posts under a specific category on static front page?
- How to get the latest URL of my blog?
- Give posts a particular template based on the assigned category
- How to have more than one page for your posts if you have 8 posts but can store max 4 on a page
- Extract wordpress posts content and category content
- All categories displays the same posts
- Having pages after specifying post_type post
- Unable to differentiate between two categories under custom post type on single.php
- In what context should Categories and Tags be used
- Show posts on front page only
- list posts from two categories on a page – plugin not working
- How to set a certain Custom Template to a Single Blog Post
- Use posts_where to exclude posts ids from wp_query
- Retrieving posts by their date and category
- Get latest post from categories
- How to create a playlist for audio associated with posts per category
- Are post, page and category IDs unique to each other?
- Change the background of each post according to the category
- Static pages not working
- Post-Archive like a page in a specific subdirectory
- Programmatically add posts from specific category to menu
- WP_Query of Category Not Showing First Post
- Sidebar on single.php not showing up
- Post is in descendant category not working in home.php
- WordPress displays post on subcategory only
- Where is the “Posts”/”Blog” template?
- How to get posts ordered by using their categories?
- Remove Featured Image from posts in specific category?
- How to show a featured image inside a post in only 1 single category
- Hide parts of the post content after typing it’s name or searching it by category
- SQL Bulk Move old posts by one author to another category
- How to display only one category in a custom post type?
- load more posts by category
- Get post category as a separate string and url
- Get only X number of categories
- Display Related Posts by Category in Random
- inserting a category into post
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- How to make posts being uncategorized
- How to show category based post in home page?
- How to display a single(current) post from a category
- Sidebar limiting to 10 posts?
- posts going to 2 pages/categories only show up in 1
- displaying the categories post
- How to show beneath posts the full category path?
- What’s a theme that properly handles previews of different types of posts?
- Display Parent Category of a Post belonging only to Subcategory
- How to separate each individual blog post?
- How to view all posts (on site, not admin) that are uncategorized?
- How to create a list of links to post with specific category
- Conditionally exclude post from specific category on home page sidebar?
- How to list post as buch of category, and all of them
- latest post showing up twice on posts page
- wp_list_categories() Exclude All Categories Except One
- Direct some posts to only appear on a specific page
- How can I add a page that shows posts from a single category?
- Highlighting Current Category in the Archive and Feeds page
- Categories Listing and Highlighting current category item
- Get current taxonomy and display query accordingly
- Can I style single post that are in multiple catergories?
- Geting error in post and category [closed]
- Different post views for different category views
- Display most recent posts in category with Twenty Ten theme widget
- Possible?! A contextually titled back link
- posts and cms and posts again
- How to add content above footer in posts from specific category
- Rewriting blog permalinks
- Changing The Default Header POST Title and Description text by category in wordpress
- Display hierarchical categories/sub-categories for a single post only
- Separate blog and reviews categories
- Display Current Posts Category (with the most posts)?
- Allow / show post comments in category pages
- Display a specific category in a focused area of my site
- Post in bulk based on category template
- How to select a category automatically based on a word in WordPress post title?
- How to make ajax load posts from the current category?
- WordPress – When visiting a `single post/ single.php` my category menu item link becomes active
- why my urdu text is not aligned properly when written in wordpress blog post?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Remove subcategory slug from url
- Create a List of Widgets, where each widget holds three attributes
- Display default matabox of posts(add category) wordpress
- Can I show category name in url for only one of my categories?
- Automatic duplicate/copy of post to a related page in WordPress
- Post meta not working