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?
- How to get category and archive title?
- Get rid of WordPress category, tag and author archives?
- Category archive by year with permalink support /category/YYYY
- Best Way to Redirect Category to Page and Hide Category
- get_categories for custom post type with a specific custom taxonomy attached
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- 404 Error On Category and Tags Pages
- Force WordPress to Show Pages Instead of Category
- Decreasing the Memory Consumption of a WordPress Site?
- What’s the URL for a category archive?
- Preventing index.php?category_name=something from redirecting
- Add forward slash on categories url (serve one version of a url)
- Sort posts by tags in category pages
- 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?
- Redirecting specific category posts to subdomain
- Display posts links from a category group by year
- How to Set an Individual Homepage for Each User?
- 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
- How would you create a “weekly” archive?
- Sticky Posts Not Sticking to Top of Category Archive
- Display most recent post in category instead of archive?
- 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)
- I want exclude the particular category in sidebar
- How to filter archives both by category and tag?
- 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
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- 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
- Sorting posts by season
- weekly archive for custom category
- WP_Query() returns null when results exist!
- WordPress subcategories return 404 in custom template
- 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/
- Archives for each category on WP Multisite
- Category index featured image
- Archive.php filtered by pre-determined category
- How do I call posts with a certain tag?
- WordPress category page redirects in .htaccess not working
- Why do my categories redirect?
- Category being displayed without base parmalink
- How to change category and year archive permalinks/rewrite rules?
- How can I define a custom archive for childs of a specific category?
- Get parrent category name
- Restoring default article pagination on archives – Removing custom limits
- 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
- Custom archive.php: retrieve right post categories?
- wp_dropdown_categories() scripts working erratically on sidebar
- Yearly Archive for Categories with dropdown
- Sub Categories Keep Redirecting to Pages With Same Slugs
- Category archives with monthly pagination
- 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
- Automatically redirect a page to a category that share the same slug
- 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
- About title on a page
- 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
- Use blog as base for tags and categories
- Media (images, videos, etc.) not showing on Category page
- WordPress monthly archive category specific
- Shows only one Category in home page
- Problem with multiple loops in wordpress theme
- Displaying year once in category.php [duplicate]
- 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)