Restrict specific private page to a specific user
Each user has a user meta called profile_url chosen during registration.
After user creation, a page with that slug is created and made private (the author of the page is the admin).
The user in his front-end dashboard has the possibility to make this page public or private.
When the page is private, the owner user cannot see it.
I would like to make the private page visible to the owner user.
The only way that came to mind is to add capabilities, like:
$ user = new WP_User ($ user_id); $ user-> add_cap ('read_private_pages');
but I’d like to specify the page id, and I don’t know if it’s possible.