вопрос решил
function fix_missing_404_on_paginated_page() {
global $wp_query,$page,$paged;
if (!isset($page)) $page = get_query_var('page');
if (!isset($paged)) $paged = get_query_var('paged');
if (is_page() || is_single()) {
$realpagescount = count( explode( '<!--nextpage-->', $wp_query->post->post_content ) );
if ( (isset($page) && isset($realpagescount) && $page >= $realpagescount) || (is_paged() && isset($paged) && $paged >=0 ) ){
//wp_redirect( home_url() );
nocache_headers();
status_header( '404' );
$wp_query->is_404=true;
$wp_query->is_single=false;
$wp_query->is_singular=false;
$wp_query->post_count=0;
$wp_query->page=0;
$wp_query->query['page']='';
$wp_query->query['posts']=array();
$wp_query->query['post']=array();
$wp_query->posts=array();
$wp_query->post=array();
$wp_query->queried_object=array();
$wp_query->queried_object_id=0;
locate_template('404.php', true);
exit;
}
}
}
add_action('template_redirect', 'fix_missing_404_on_paginated_page');