Need some Tweak my nextpage Function

How I can get the next post URL when I'm on the last page ?

e.g. I want go to the nextpost when i'm on the last page...

This code need some tweak...

Here is my Function:

function next_page( $i ) {
    global $page, $numpages, $multipage, $more, $pagenow;
    if ( $multipage ) {
        if ( $more ) {
            $i = $page + 1;
            if ( $i = $numpages  $more ) {
                $output .= _wp_link_page( $i );
            }
        }
    }
    if ( preg_match( '/href="([^"]+)"/', _wp_link_page( $i ), $match ) )
    return $match[1];
}

Best regards.

Topic nextpage functions Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.