How to show different pages for different users

You could handle this using Pages and Custom Post Types.

For content that everyone can see, use regular WP Core Pages.

For restricted content, build custom post types with mapped custom capabilities. You can then assign a role to each user, such as “coach” who can see all the content including scores, “team1” that can see team 1 posts including scores, and “team2” that can see team 2 posts including scores.

You can start with this code for a custom post type and build out any other options you need on your site:

<?php
// Define custom capabilities for this post type.
$capabilities = array(
    'edit_post'              => 'edit_team1',
    'read_post'              => 'read_team1',
    'delete_post'            => 'delete_team1',
    'create_posts'           => 'create_team1',
    'delete_posts'           => 'delete_team1',
    'delete_others_posts'    => 'delete_others_team1',
    'delete_private_posts'   => 'delete_private_team1',
    'delete_published_posts' => 'delete_published_team1',
    'edit_posts'             => 'edit_team1',
    'edit_others_posts'      => 'edit_others_team1',
    'edit_private_posts'     => 'edit_private_team1',
    'edit_published_posts'   => 'edit_published_team1',
    'publish_posts'          => 'publish_team1',
    'read_private_posts'     => 'read_private_team1',
);
$args         = array(
    // Map Meta Cap ensures your custom capabilities are used.
    'map_meta_cap'  => true,
    'show_in_rest'  => true,
    'public'        => true,
    'supports'      => array( 'title', 'editor', 'author', 'revisions', 'page-attributes' ),
    'capabilities'  => $capabilities,
);
register_post_type( 'team1', $args );
?>

Then you’ll need a role with read_team1 capabilities for anyone who can read the team 1 posts (which would include scores and anything else you’re protecting).

<?php
add_role('team_one_player', 'Team One Player', array(
    // Let them read Team 1 CPTs.
    'read_team1' => true,
    // Also let them read Core content like Pages.
    'read' => true
    )
);
?>

And you’ll probably want to grant Admins access to edit/delete. They don’t have access by default so you have to grant it explicitly:

<?php
$admin = get_role('administrator');
$admin->add_cap('create_team_1');
$admin->add_cap('delete_team1');
$admin->add_cap('delete_others_team1');
$admin->add_cap('delete_private_team1');
$admin->add_cap('delete_published_team1');
$admin->add_cap('edit_team1');
$admin->add_cap('edit_others_team1');
$admin->add_cap('edit_private_team1');
$admin->add_cap('edit_published_team1');
$admin->add_cap('publish_team1');
$admin->add_cap('read_team1');
$admin->add_cap('read_private_team1');
?>

You’ll just need to think carefully about how to structure the URLs in a way that makes sense for visitors, and you’ll also need to think about UX. For example – are you going to have site navigation that links to all the pages, and have visitors without the proper capabilities get a “Sorry, you can’t access that” message? Or, are you going to build conditional navigation that checks each link and only displays what the current user has the ability to view?

Alternatively, you could look into existing membership plugins. You could set up a “membership” for team 1 protected content, and a separate type of membership for team 2 protected content, potentially without coding.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)