Redirect to most recent post

Adding this to the functions.php of your wordpress theme will redirect visitors to the most recent post when visiting the homepage.

 

 

 

add_action( 'template_redirect', 'redirect' );
function redirect() {
if ( is_home() && ! is_paged() ) :
wp_redirect( get_permalink() , 301 );
exit;
endif;
}

Be Sociable, Share!

Leave a comment