Have a little issue that i hope someone can help me out with. I have a WordPress website that i only want to grant employee’s access to. So I’d like to use a HTTP Referer so that way i can add a link from our intranet site, kind of like this…

if (strpos($_SERVER["HTTP_REFERER"],'intranetsite.com') == true) 
 echo "/";
 header( 'Location: http://wordpress.com/wp-admin' ) ;

However i would also like to add a list of trusted ip addresses, using the following code…

$allowlist = array(

    header('Location: http://wordpress.com/wp-admin');

What would be the easiest way to combine this code? Or is there a better way i should be doing this?

Hope this all makes sense, if not let me know if i need to clarify on anything.

Apologize for my lack of coding ability, still learning the ropes. Any help at all would be great appreciated.

Read more here: HTTP_REFERER & REMOTE_ADDR Combined


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: