Site logo

Archived topic

Change the generate_logo_href to be for logged in users only

3 replies · Started by Carsten on March 27, 2022

Viewing posts 1–4 of 4

Hi there, I'm using this code snippet to change the URL destination of my logo

 add_filter( 'generate_logo_href', function() {
    return "https://domain.com/activity/";
} ); 

The /activity/ destination as I use here, is for logged in users only, so when logged out users on my frontpage click the logo, it return a "To many redirections" error.

I want the code to work for logged in users only, so when logged out users click the logo, it returns the frontpage as default.

Can you help?

Thanks!

Hi there,

try adding this PHP Snippet instead:

add_filter( 'generate_logo_href', function($url) {
    if ( is_user_logged_in() ) {
        $url = "https://domain.com/activity/";
    }
    return $url;
} ); 

Hi David, thanks a lot for your quick response on a sunday, the code is working great!

Regards
Carsten

Awesome - glad to hear that!

This archived topic is closed to new replies.