• Hi there.
    I have add some white list page. But it not working with wp-admin page

    function forcelogin_whitelist() {
      return array(
        site_url( '/forgot-password/' ),
        site_url( '/wp-admin/' ),
        site_url( '/register/' )
      );
    }
    add_filter('v_forcelogin_whitelist', 'forcelogin_whitelist', 10, 1);

    I want login wp-admin it redirect to wp dashboard. Thanks.

    https://www.ads-software.com/plugins/wp-force-login/

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

    (@kevinvess)

    The wp-admin pages of a WordPress site are not usually accessible without requiring a user to login. I don’t understand why you would want to whitelist the wp-admin area even if you could.

    Normal WordPress functionality requires users to login to view the wp-admin and it should send them to the WP dashboard by default if they’ve gone directly to the login URL.

    If a visitor tries to view one of the front-end pages, like the homepage or a post..etc, that is when they get redirected to the login screen which sends them back to the page or post they tried to view in the first place.

    Plugin Author Kevin Vess

    (@kevinvess)

    Also, if you’re trying to whitelist everything in the wp-admin directory and not just the single page URL, try this code instead:

    function my_forcelogin_whitelist( $whitelist ) {
      // list of single page URLs
      $whitelist[] = site_url( '/forgot-password/' );
      $whitelist[] = site_url( '/register/' );
      // add any page URL within a directory to my whitelist
      if( in_array('wp-admin', explode('/', $_SERVER['REQUEST_URI'])) ) {
        $whitelist[] = site_url($_SERVER['REQUEST_URI']);
      }
      return $whitelist;
    }
    add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘White list with wp-admin’ is closed to new replies.