function exclude_single_posts_home($query) {
if ($query->is_home() && $query->is_main_query() && !is_admin()) {
$query->set('post__not_in', array(post-id));
}
}
add_action('pre_get_posts', 'exclude_single_posts_home');
Source: pre_get_posts
Related Posts:
- How to show post(excerpt) from specific category on wp page?
- Can I divide the pages into categories?
- Should I use posts or pages in this scenario?
- post categories
- Post categories to pages
- How to create a “latest news” page showing a list of posts from blog category
- How to call posts under a specific category on static front page?
- Having pages after specifying post_type post
- Show posts on front page only
- Are post, page and category IDs unique to each other?
- Create a frontpage.php and static page template
- posts going to 2 pages/categories only show up in 1
- How can I add a page that shows posts from a single category?
- Different post views for different category views
- Automatic duplicate/copy of post to a related page in WordPress
- Yoast breadcrumb URL shows category instead of the page
- How to distinguish pages created by woocommerce?
- How to add a block to a category page?
- Page with Category Returning 1
- Category posts show on local install, they do not show on live server
- Category and Posts in front page
- Post Category link is same with Page link
- How do I make it so that new posts within a certain category go into a certain page?
- Precedence of page permalinks over woocommerce product category links?
- Show only top 3 posts from 3 categories in order on home page
- Displaying only posts from a certain category on my custom page template
- I need to create a page or post hierarchy
- how to style an individual page in a category [duplicate]
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- wordpress category Description not allowed tag
- The next_posts_link() works only with original $wp_query
- Different post sort order within different categories
- Using single.php from plugin folder instead of default template folder
- Skipping first 3 posts in wp query
- Callback for wp.autosave.server.triggerSave();
- How can I see a list of pages and post where my custom Gutenberg block is used?
- How to add metabox for post of specific category
- How to get Category Id from Post Id ?
- Exclude category on blog list page
- Pagination for Pages and Posts
- Overview with latest edited posts and pages
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- WordPress Child Category Display All Posts
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- Limit function to specific post category
- Show all post titles
- Posts are not showing up on particular category
- Can a page_id and a post_id be same?
- Differentiate between posts and pages in search results
- Getting a 404 error when clicking edit page
- How to display related posts by subcategory and not parent category
- Category Template: Need to display different content on first page of archives
- Extracting post categories
- How to limit posts by category
- How to list recent posts in a wp nav menu?
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- How do I do a page break?
- why does wordpress ignore the post args?
- static landing page leading to author specific pages w/ “live” content
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- WordPress 302 Redirect to Random Product/Post/Page
- Sort by last word in title
- Give posts a particular template based on the assigned category
- Post-Archive like a page in a specific subdirectory
- How to display only one category in a custom post type?
- Get only X number of categories
- inserting a category into post
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- Use Post as Front Page
- 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
- “Home” Page now only displaying the single latest post
- Possible?! A contextually titled back link
- How to select a category automatically based on a word in WordPress post title?
- Display default matabox of posts(add category) wordpress
- How to get tags when using publish_post
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- How do you change the permalink for posts for a single category?
- Exclude posts in a category on one page but show those posts on a different page
- Excluding category from post navigation in WordPress?
- Post not showing in the front page
- Get a list of categories that are related to posts
- Querying posts from current category, using a variable as array argument
- Need help writing loop to display posts by categories in separate divs
- Add category selection to function request
- Query post category & remove any post id
- Converting Posts to Pages
- Multiple Post Repeat for Related Post Loop by Category
- Show Post number of specific Category
- 404 error on every post and page other than home
- how to show posts on different pages if number of post per page is one
- The next_posts_link() works only with original $wp_query
- Is it possible to have different header style blog titles in different categories?
- Category pages vs single post pages
- How do we display a certain category type on a page while hiding all others?
- How to make posts appear under pages
- Header and Footer options in pages and posts
- Blog posts are not appearing as subs of Blog Page