Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • willdries

    (@willdries)


    We had the same problem. Also with CloudWays by the way. We think it has something to do with the caching technique their using.

    For CloudFlare we created a Page Rule for bypassing the Cloudflare cache. So for us Restricted Site Access is working now as intended with that Page Rule active. Maybe this can be helpful.

    • This reply was modified 2 years ago by willdries.
    • This reply was modified 2 years ago by willdries.

    Hi @renaisens and @vinayakboga8 ,

    Maybe this can help you:

    add_filter( 'restricted_site_access_is_restricted', 'exclude_page_from_restriced_access', 10, 2 );
    
    function exclude_page_from_restriced_access( $is_restricted, $wp ) {
    	$url = 'https://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
    	$current_post_id = url_to_postid( $url );
        if ( $current_post_id  == '644' ) {
            $is_restricted = false;
        }
        return $is_restricted;
    }

    In my case I had to exclude a page with ID 644. You have to put this code in functions.php. It maybe is a quick and dirty solution, but it works for me.

    Regards Will

Viewing 2 replies - 1 through 2 (of 2 total)