You still are going to make use of pre_get_posts
to alter the main query query vars before the main query actually runs. The blog page/homepage can be targeted with the is_home()
conditional tag
add_action( 'pre_get_posts', function ( $q )
{
if ( is_home() // Only targets the home/blog page
&& $q->is_main_query() // Only targets the main query
) {
// Works on build in taxonomy category, for custom taxonomies, use a tax_query
$q->set( 'cat', -1 ); // Change with correct category ID, minus sign means remove
}
}, PHP_MAX_INT ):
I would add this into a plugin which you can activate (as Super Admin) as a network plugin across the entire network
Related Posts:
- Apply the_title() filter in post & page title, but not in menu title
- Update post counts (published, draft, unattached) in admin interface
- Removing any and all inline styles from the_content()
- Removing filter dropdown in posts table (in this case Yoast SEO)
- How to Display Network Post Count?
- Get old values for post before saving new ones
- How does filter the_posts work?
- How to publish a post with empty title and empty content?
- How to cache a shortcode functions output?
- Querying post from a multisite network
- How to add a “publish” link to the quick actions
- How to get a post content from another wordpress blog/site?
- Why is wordpress removing some unicode characters (e.g. some emojis) when I save my post?
- how to enable different number of revisions for different blogs when using WPMU?
- how to display post content without post image?
- Exclude category on blog list page
- How to remove_filter that filters iframes in posts? [duplicate]
- Filter posts by author and category simultaneously
- Strange switch_to_blog() issue
- Filter post before *editing*
- Filter/Remove HTML Elements on all posts and pages
- How to hook a function only when I need to delete permanently a post?
- How to share same post to multiple site in wordpress?
- How to create post in WP network using WP-CLI
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- Pull posts from another wordpress install on same server
- If specific user role then sticky post
- Query posts from different categories in multisite
- Getting post id from wp_insert_post_data function?
- the_posts filter been called multiple time
- Filter Posts By Tag
- Custom excerpt length filter doesn’t work
- How can i do something after head like adding a hook for after head but before post
- Only display posts after current date
- Amend wordpress password function
- Custom Post Templates
- How can I remove posts of a certain category from homepage after a specified time period?
- How to generate numbers indistinguishable for the IDs of the posts
- Modify WP_Post before processing
- How to filter posts that belong to a specific category only if that is the only category
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Filter Custom Post Type by Category with Ajax
- Multisite – Get current post id
- Ajax posts filter by date, comments, top views, top likes
- How to add Tags Filter in wordpress admin dashboard
- pre_get_posts query between 2 dates (date stored in custom post meta)
- Applying $posts_clauses filter to specific queries only
- how to remove dash (-) post status from post title on posts listing page wordpress
- Admin Posts Table Column Fitlering is not working for Custom Post Type
- Get latest posts from WordPress site without header, menu and sidebar
- Modify Image Source With The_Content Filter?
- How to show last post of each website of a MU wordpress in HomePage
- What is the filter or hook to add admin controls to posts on the front end?
- Change post order random through out the entire WordPress
- use wpml_post_language_details function other plugin based on $post->ID [closed]
- How to hide html tags on revision comparison pages?
- Add filter by custom field to block of posts
- Ajax post filters not working
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- How to display content from the main blog on another from multisite network as it would be its own
- Display Meta Values in Custom Filter – Admin Custom Posts
- How to filter my search in post if contains a word in title, content or excerpt?
- More then one menu items are assigned with “current-menu-item” class
- Multisite: Can’t Post or Create Categories
- Update post_content everytime a custom post is opened in backend
- Unable to restore from backup – how to obtain old blog posts?
- Posts and Attachments with “Published” status in Search
- Pagination with an array of post objects?
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Set static page/post from another blog on same network
- How to allow visitors to filter posts by multiple taxonomies
- Redirect to another page using contact form 7? [closed]
- Trying to alter the post_content through the_post
- add to end of post in the loop with plugin
- Add filter to the end of the post
- How to WP_Query() from multiple blogs and order them?
- Get post content with all filters applied, knowing post id
- Adding bootstrap classes to video shortcodes
- query post limits
- How do I show posts from another wordpress installation?
- Display password protected posts to logged in users
- Modify posts listing at back end
- Filtering posts on Post Administration Page by Week Number instead of by Month
- Prevent posts with certain post_meta to be edited
- Change the default blog post post attribute template name from “default template” to something else
- Hook for changing excerpt content when excerpt not set
- Is it possible to add a shortcode below post title?
- Get image paths from RSS feeds
- making a few sites in wordpress
- the_content() not displaying the full post
- wp_query posts sorting doesn’t work
- Add custom PHP (no-SQL) filter to WP_query
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Filters do not work when there are multiple (one works)
- users followin the blog post author
- How can I change the post order after filtering in WordPress?
- Modify upload directory to use post category slug in file path on multisite installation
- Add function to single blog post pages only
- Unable to create categories and tags for posts in wordpress multisite