WordPress auto restrict user to only edit one page

When a user signs up i want to create a page with the title of the user name, and then set permission so the user only can view and edit that page from the backend.

I have search a lot to try to figure it out the only thing i could find was this code which works for creating the page but how do i set the permissions?
All of this shall happen automatic on user signup.
If there is a better way or solution i would love to hear it

Read More
function my_create_page($user_id){
  $the_user = get_userdata($user_id);
  $new_user_name = $the_user->user_login;
  $my_post = array();
  $my_post['post_title'] = $new_user_name;
  $my_post['post_type'] = 'page';
  $my_post['post_content'] = '';
  $my_post['post_status'] = 'publish';
  wp_insert_post( $my_post );
}
add_action('user_register', 'my_create_page');

Thanks

Related posts

Leave a Reply