[Resolved] Change Logo URL Based on User's Role

Home Forums Support Change Logo URL Based on User's Role

This topic contains 4 replies, has 2 voices, and was last updated by  Tom 11 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #492493



    My site has two main user roles, “dealer” and “supplier”. I’d like to have the main logo url link to a specified page based on the current user’s role. For any role other than “dealer” or “supplier”, I’d like the logo to link to the default home page. I referenced this topic which got me part of the way there, but I’m wondering if the edits I made to the code are correct. Could you guys double check for me? Any help would be much appreciated! Thanks!

    add_filter( 'generate_logo_href','tu_add_custom_logo_href' );
    function tu_add_custom_logo_href( $url )
        $user = wp_get_current_user();
        if ( in_array( 'dealer', (array) $user->roles ) ) {   
            return '/dealer-home';
        $user = wp_get_current_user();
        if ( in_array( 'supplier', (array) $user->roles ) ) {   
            return '/supplier-home';
        // All the other pages
        return $url;
    GeneratePress 2.0.2
    GP Premium 1.5.6


    Sorry! I should have mentioned, I’d like these changes to apply to all instances of the logo (i.e. sticky desktop, sticky mobile, etc.) if possible. Thanks guys!


    Tom Lead Developer

    Your code looks great to me. Is it not working?

    Let me know 🙂



    Haha! I suppose I was second guessing myself.

    Sure enough, everything is working properly. Thank you for an AMAZING theme and support!


    Tom Lead Developer

    You’re very welcome! Thanks for using it 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.