• Resolved jezreelbondad

    (@jezreelbondad)


    Hello,

    I used this code to whitelist my custom registration page. I used the page ID but it still redirects to the login page.

    /**
    * 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 ( is_page( 2569 ) ) {
    $bypass = true;
    }
    return $bypass;
    }
    add_filter( ‘v_forcelogin_bypass’, ‘my_forcelogin_bypass’ );

    I also tried using this to no avail

    /**
    * Filter Force Login to allow exceptions for specific URLs.
    *
    * @param array $whitelist An array of URLs. Must be absolute.
    * @return array
    */
    function my_forcelogin_whitelist( $whitelist ) {
    $whitelist[] = home_url( ‘/register/’ );
    return $whitelist;
    }
    add_filter( ‘v_forcelogin_whitelist’, ‘my_forcelogin_whitelist’ );

    The page I need help with: [log in to see the link]

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

    (@kevinvess)

    Hi– thanks for using Force Login!

    Your code looks correct, but maybe it’s not running? Have you added this code to your theme’s functions.php file?

    Have you tried enabling WP_DEBUG mode to see if any errors are being logged?

    Maybe you had the wrong page ID? Try using the slug instead?

    /**
     * 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 ( is_page('register') ) {
        $bypass = true;
      }
      return $bypass;
    }
    add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );
Viewing 1 replies (of 1 total)
  • The topic ‘Whitelist not working’ is closed to new replies.