Redirect home page to first blog post

Place this snippet at the top of the index.php template of your wordpress theme before get_header(). Your homepage will then automatically redirect to the first blog post.

 

 

<?php
if (have_posts() && is_home()) {
while (have_posts()) {
the_post();
wp_redirect(get_permalink());
}
}
?>

Be Sociable, Share!

Leave a comment