Website pages visible only to registered users

i’ve a wordpress website and i want to restric 2 page to registered users only. I don’t want to add another plugin, since i can’t code, i’ve found online this piece of code, how can i add more then one page?

add_action( 'template_redirect', 'redirect_to_specific_page' );

function redirect_to_specific_page() {

if ( is_page('gift') && ! is_user_logged_in() ) {

wp_redirect( 'http://website.com/login', 301 ); 
  exit;
    }
}

Read more here: Website pages visible only to registered users

Leave a Reply

Your email address will not be published. Required fields are marked *