Bypass all relative path | WordPress.org

[ad_1]

Hi– thanks for using Force Login!

I recommend you use the is_page() Conditional Tag to bypass visits to that page instead of using the absolute URL method.

Also, in case you’re unaware, the if ( is_single() ) { line in your bypass function is allowing all Posts to be publicly available. That was intended as an example in the FAQ and not required to use the bypass filter.

/**
 * Bypass Force Login to allow for exceptions.
 *
 * @param bool $bypass Whether to disable Force Login. Default false.
 * @param string $visited_url The visited URL.
 * @return bool
 */
function my_forcelogin_bypass( $bypass, $visited_url ) {

  if ( is_page('gps') ) {
    $bypass = true;
  }

  return $bypass;
}
add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass', 10, 2 );

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer