WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Can one auto-authorize based on visited IP?

[Resolved] Can one auto-authorize based on visited IP?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ben Huson

    @husobj

    This plugin doesn’t do it out of the box.
    However you can use a filter to do this.

    Something along the lines of:

    function password_protected_check_ip( $bool ) {
    	// Check the IP address here and return 0 (ie disabled) if you want to allow the IP address
    	return $bool;
    }
    add_filter( 'pre_option_password_protected_status', 'password_protected_check_ip' );

    Awesome!! Thanks very much Ben. Will try to implement now.

    AND, it works!

    In case anyone comes across this looking for the solution, it is as simple as this;

    function password_protected_check_ip( $bool ) {
    	// Check the IP address here and return 0 (ie disabled) if you want to allow the IP address
    	if($_SERVER['REMOTE_ADDR'] == "160.79.66.166") {
    	$bool = 0;
    	}
    	return $bool;
    }
    add_filter( 'pre_option_password_protected_status', 'password_protected_check_ip' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Can one auto-authorize based on visited IP?’ is closed to new replies.