Support » Plugin: Force Login » How to bypass the 404 Error page?

  • Resolved cngcng

    (@cngcng)


    Hi,

    How to I show/bypass/whitelist the 404 error page?

    I want my site work normally except request for a login for some secret pages. Now, if visitors try non-existing url will lead them to the login page instead of the 404-error page.

    Thank you,
    Charon

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

    (@kevinvess)

    Hi– thanks for using Force Login!

    You can bypass Force Login using the WordPress Conditional Tags, like is_404().

    For example:

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

    Hi Kevin,

    You solved my problem. Thank you 🙂

    CNG

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to bypass the 404 Error page?’ is closed to new replies.