My WordPress website is now redirected to latest post by adding below function to function.php
add_action( 'template_redirect', 'redirect' );
function redirect() {
$args = array(
'numberposts' => 1,
'post_type' => 'seller',
'post_status' => 'publish');
$last = wp_get_recent_posts($args);
$last_id = $last['0']['ID'];
if ( is_home() && ! is_paged() && ! is_archive() && ! is_tag() && !isset($_GET['ptype']) ) :
wp_redirect( get_permalink($last_id) , 301 );
exit;
endif;
}
now, I want this feature but without changing URL to latest post! I mean when you go to http://www.example.com latest post shows without a 301 redirect to http://www.example.com/article/some-other-texts