title: php function for wordpress to restrict not-logged-in-users
body: <p>How to write a <code>php</code> function for <code>wordpress</code> to allow not-logged-in-users access only 3 pages: <code>mysite/login/</code> &amp;&amp; <code>mysite/register/</code> &amp;&amp; <code>mysite/lostpassword</code>  ?</p>
  
  <p>I've tried with Restricted Site Access plugin </p>
  
  <p><code>(https://ro.wordpress.org/plugins/restricted-site-access/)</code>, </p>
  
  <p>BUT it allows me to access only login and register pages</p>
  
  <p>Any ideas?</p>