Eliminating all of the other solutions, there is at least one remaining: template_redirect
:
function wpse121308_redirect_homepage() {
// Check for blog posts index
// NOT site front page,
// which would be is_front_page()
if ( is_home() ) {
wp_redirect( get_category_link( $id ) );
exit();
}
}
add_action( 'template_redirect', 'wpse121308_redirect_homepage' );
You will need to pass the appropriate category $id
, of course.
The benefit of redirecting at template_redirect
is that you only get one template-load taking place, rather than a second redirect after the template loads.
Edit
As per @Milo’s comment, you could also try hooking into the process even earlier, at pre_get_posts
, thereby potentially saving an entire query request:
add_action( 'pre_get_posts', 'wpse121308_redirect_homepage' );
Related Posts:
- How to display post in custom file not in archive file?
- Redirect Problems with Archive Page and GET variables
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- Category archive by year with permalink support /category/YYYY
- get_categories for custom post type with a specific custom taxonomy attached
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Force WordPress to Show Pages Instead of Category
- Decreasing the Memory Consumption of a WordPress Site?
- What’s the URL for a category archive?
- Add forward slash on categories url (serve one version of a url)
- Multisite blog converting categories to subdomains
- How to get the category of the post and link it to the archive (of the category)
- How to hide a specific category posts in my monthly archive?
- Display posts links from a category group by year
- Display list of Sub-Categories and the posts they contain, within one main Category
- How to: 301 Redirect /category/ to /customname/
- How to? Redirect /category/sci-fi/ to /category/scifi/?
- Sort category page with custom field
- How to create tabled index of posts in a certain category
- Redirecting category link to first child post
- Root level category, tag, author and archive pages to work
- Category Specific Archive
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Are Custom Taxonomy Templates Possible?
- “Sticky” posts for each category (archive.php)
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Display only posts from referred category on date archive page
- Using widget logic I want to show only a widget on the archive page if there are no posts
- Redirect category to first available child post
- display woocommerce all category title on home page
- Creating archive pages for children categories
- Display “add to cart” button on every listing in product category page?
- WordPress categories being called “archives” in google links. How to remove?
- conditional for sub category on archive page
- weekly archive for custom category
- WP_Query() returns null when results exist!
- How to remove category titles?
- Show archives by year from just one category
- Redirect category to url with /category
- Changing permalink from /postname/ to category/postname/
- Archive.php filtered by pre-determined category
- How do I call posts with a certain tag?
- WordPress category page redirects in .htaccess not working
- Category being displayed without base parmalink
- How can I define a custom archive for childs of a specific category?
- Category archive rewrite rule to include category/subcategory?
- add_rewrite_endpoint returns 404 on archives
- Multiple category archive page
- WP didn’t redirect to canonical category URL
- Sub Categories Keep Redirecting to Pages With Same Slugs
- Customize category page for different custom taxonomies
- redirecting from a general category page to another specific one
- Redirect single article permalink to paginated category page
- Category archive is displaying all posts rather than the specific category
- How to Remove a Title from All Category and Tags Page?
- WordPress link to post links to category (loop)
- Do not show sub categories in the loop on archive-product.php
- why get_the_post_thumbnail( the_ID()) echos extra post id
- Posts from a category on homepage with category archieves page default css
- display category list year wise in wordpress
- WordPress showing wrong category name
- Media (images, videos, etc.) not showing on Category page
- WordPress monthly archive category specific
- Shows only one Category in home page
- what file I need to create to work date archive links?
- Archive filtering
- Category link redirect to custom template page instead of index.php?
- Show Secondary Sidebar on Category pages (archive)
- Rebuilding a Site: How to Show Several Category Posts in Woo Framework Theme?
- Displaying a custom field in Category Archives
- Add multiple orderby with pre get posts
- Homepage custom recent news
- pagination 404 error, same slug home and categories
- OK to redirect the root WordPress category slug?
- Show the parent taxonomy by creating shortcode in woocommerce?
- How Can I Display the Category Description in a Theme with no Category.php or Archive.php?
- Display Category yearly wise in wp
- How to add excerpt and read more button to category archive page
- How can I exclude a particular category from my WordPress Page 1 and Page 2?
- Default URL for category dropdown select option
- custom browse by
- WordPress Category url redirects to subdomain
- How to get get_categories()’s ‘hide_empty’ argument to work with global year var in the archive template?
- get_the_terms_list output last child only
- How to get related category/categories in WordPress archive page
- Category archives
- Create monthly archive for parent category
- Conditional statements based on custom meta value in category archives
- date.php shows all posts. how to fix it?
- Display last postings of 5 categories on homepage
- Page redirecting to category (IE only)
- 2 loops in archive.php (one for each category)
- Archives and category of authors
- Category Archives: Show posts categorized in parent category only
- Country Ways Content Show
- All post of child category not in top category
- How to show monthly archive posts?
- how to implement next/prev within category archive?
- How to link ACF relationship field to the new Query block in Full Site Editing
- Category Redirection Problem