How to check if page exists in Multisite?

get_page_by_path() will only search in the current site.

If you need to find a page anywhere in your Multisite network, you can do something like this.

function network_page_exists( $path ) {
    $args = array(
         // Max sites to retrieve.
         // If you have a large network, increase this.
        'number' => 100,
    );
    $sites = get_sites( $args );
    $found = false;
    foreach ( $sites as $site ) {
        if ( ! $found ) {
            switch_to_blog( $site->blog_id );
            // Uses your page_exists() function in the sites
            // till we find the post, or till we run out of sites.
            $found = page_exists( $path );
            restore_current_blog();
        }
    }
    return $found; 
 }

Note: switch_to_blog() can slow your site down if you’ve got a large network. You might want to look into how you can cache your results (perhaps using an option). Since that’s pretty dependent on your specific situation, it’s not addressed in this answer.

References