Site logo

Archived topic

I'd like to change the logo link only to the logged-in user.

7 replies · Started by Lim on August 16, 2021

Viewing posts 1–8 of 8

Hello

I'd like to change the logo link only to the logged-in user of Generate Press.

When the user clicks on the logo above the top menu.

Unlogged user: domain.com/home
Loggined user: domain.com/start-line

I searched and found the logo filter, but there was no same answer.

I'm asking for help because I'm not a developer and I can't change it.

Hi there,

We can filter the logo's link using generate_logo_href for this.

Example:

add_filter( 'generate_logo_href', function( $url ) {
    if ( is_user_logged_in() ) {
        return esc_url( home_url( '/start-line' ) );
    }

    return $url;
} );

I don't know, but this code doesn't seem to work.

I inserted it into the code snippet plug-in.
But it doesn't work.

The URL that the logged-in user wants to go to is:

domain.com/kr/start-line

-------------------------------

add_filter( 'generate_logo_href', function( $url ) {
    if ( is_user_logged_in() ) {
        return esc_url( home_url( '/kr/start-line/' ) );
    }

    return $url;
} );

I insert the code in my site.

Can you look at the code again?

Hi there,

in the Code Snippets do you have the snippet set to Run Everywhere?

I have already checked everywhere.

but didn't work

please come to mysite.

Ah I see what's the issue here.

The filter I've provided was for the logo image. I see that your site isn't using one so we'll have to use another filter.

Try this instead.

add_filter( 'generate_site_title_href', function(){ return home_url( '/kr/start-line/' ) });

add_filter( 'generate_site_title_href', function(){ return home_url( '/kr/start-line/' ) });

I inserted the code in my code snippet plugin.
but it made an error.

please check the code.
I am not a devloper. I didn't know the code. sorry.

{ << right?

Ah right my bad. It's missing a ;

Let's modify things a bit.

Try this:

add_filter( 'generate_site_title_href', function($url){ 
$url = esc_url( home_url( '/kr/start-line/' ) );
return $url;
},15,1);
This archived topic is closed to new replies.