No, Core roles and capabilities don't restrict users in the way you're wanting to restrict them.
You could try an out-of-the-box role/member plugin. There is likely one available that will let you restrict one user's access.
It might be simpler to instead create a custom post type for the page itself. When you register a new post type, you can use map_meta_cap
and define your own custom capabilities. Then, you would create a role with just those capabilities, and assign the role to that user, and when they logged in, they would only have access to their user profile and editing that particular URL.
For example:
<?php
/* Plugin Name: WPSE Info Page
*/
// Register a new post type called Info (or About, or whatever you choose)
add_action('init', 'wpse_create_cpt');
function wpse_create_cpt() {
register_post_type('info',
array(
'label' => __('Info', 'textdomain'),
'public' => true,
'show_in_rest' => true,
'has_archive' => false,
'hierarchical' => false,
// This is where you define custom capabilities
'map_meta_cap' => true,
'capabilities' => array(
'edit_post' => 'edit_info_page',
'read_post' => 'read_info_page',
'delete_post' => 'delete_info_page',
'create_posts' => 'create_info_pages',
'delete_posts' => 'delete_info_pages',
'delete_others_posts' => 'delete_others_info_pages',
'delete_private_posts' => 'delete_private_info_pages',
'delete_published_posts' => 'delete_published_info_pages',
'edit_posts' => 'edit_info_pages',
'edit_others_posts' => 'edit_others_info_pages',
'edit_private_posts' => 'edit_private_info_pages',
'edit_published_posts' => 'edit_published_info_pages',
'publish_posts' => 'publish_info_pages',
'read_private_posts' => 'read_private_info_pages'
),
)
);
}
// Create a new role that has full capabilities for the Info post type
add_action('init', 'wpse_create_cpt_role');
function wpse_create_cpt_role() {
add_role('info', 'Info Editor');
// You probably want them to be able to read on the front end
$info->add_cap('read');
// And upload files, but that's up to you
$info->add_cap('upload_files');
// Here's where you really decide - should they be able to add, edit, delete
// or maybe only edit (theirs, others, private, and published)
// and not delete the page, or add additional pages
$info->add_cap('create_info_pages');
$info->add_cap('delete_info_pages');
$info->add_cap('delete_others_info_pages');
$info->add_cap('delete_private_info_pages');
$info->add_cap('delete_published_info_pages');
$info->add_cap('edit_info_pages');
$info->add_cap('edit_others_info_pages');
$info->add_cap('edit_private_info_pages');
$info->add_cap('edit_published_info_pages');
$info->add_cap('publish_info_pages');
$info->add_cap('read_private_info_pages');
}
// Optional - give Admin users the ability to edit the info page
// (Since you're using custom capabilities, they can't edit unless you do this)
add_action('init', 'wpse_grant_cpt_caps');
function wpse_grant_cpt_caps() {
$admin = get_role('administrator');
// Again, decide which capabilities you want them to have
// (usually you'll want to grant full capabilities to Admins)
$admin->add_cap('create_info_pages');
$admin->add_cap('delete_info_pages');
$admin->add_cap('delete_others_info_pages');
$admin->add_cap('delete_private_info_pages');
$admin->add_cap('delete_published_info_pages');
$admin->add_cap('edit_info_pages');
$admin->add_cap('edit_others_info_pages');
$admin->add_cap('edit_private_info_pages');
$admin->add_cap('edit_published_info_pages');
$admin->add_cap('publish_info_pages');
$admin->add_cap('read_private_info_pages');
}
?>
You can install this as a plugin to create the CPT and roles, and then you'll still need to create (or update) a user to give that person the new role for the new CPT. And if you previously published the page as another post type - example, a Page - you'll want to copy that info over, publish the page as the CPT, and delete the original Page.