• Resolved Tom DeBello

    (@tdebello)


    Great plugin, I use it on all my staging sites. But having to deactivate the plugin prior to migrating from staging to live causes a bunch of extra steps. A solution would be to bypass on a specific subdomain. For example:

    https://staging.domain.com (force login)
    https://domain.com (bypass all)

    I looked for a WP Conditional which might work but came up empty. Could this work?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    Hi– thanks for using Force Login!

    You should be able to bypass Force Login based on any condition.

    /**
     * Bypass Force Login to allow for exceptions.
     *
     * @param bool $bypass Whether to disable Force Login. Default false.
     * @return bool
     */
    function my_forcelogin_bypass( $bypass ) {
      if ( 'domain.com' === $_SERVER['HTTP_HOST'] ) {
        $bypass = true;
      }
      return $bypass;
    }
    add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );
    Thread Starter Tom DeBello

    (@tdebello)

    This works great, thanks for such a useful plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Subdomain bypass conditional’ is closed to new replies.