Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: bbp Private Group Non-Logged In User Redirect

@robin-w

Moderator

php 8.1 is a lot more fussy

try this (untested but should work)

function private_content_redirect_to_login() {
  global $wp_query,$wpdb;
  if (is_404()) {
    $host = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    $path = dirname($_SERVER['REQUEST_URI']);
    $forums = "forum";
    $location = "https://direitoshumanosangola.org/not-logged-in/";
		if(strpos( $path, $forums ) !== false){
		  wp_safe_redirect($location);
		  exit;
		}
  }
}
Skip to toolbar