• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Logo redirect based on user role

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Logo redirect based on user role

This topic is: resolved

Tagged: genesis_seo_title, site title

  • This topic has 8 replies, 2 voices, and was last updated 8 years ago by Brad Dalton.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • November 27, 2017 at 7:33 am #214012
    verykindheart
    Member

    Hi,

    I am using the Genesis framework with a genesis sample child theme. The logo redirect always links back to the home page. But I would like the logo to redirect to a different page based on the user role. For example, a 'subscriber' will be redirected to the home page, and 'contributor' will be redirected to the about page.

    Could someone kindly help me please?

    http://Local
    November 27, 2017 at 7:39 am #214013
    Brad Dalton
    Participant

    You can use this code with any conditional https://my.studiopress.com/documentation/snippets/header/modify-the-header-url/


    Tutorials for StudioPress Themes.

    November 27, 2017 at 8:09 am #214014
    verykindheart
    Member

    Thanks for your very quick response Brad. The code is a bit complex for me, but I will have a go at applying the conditional. Thanks for pointing me in the right direction though. Really appreciate it.

    November 27, 2017 at 8:16 am #214015
    Brad Dalton
    Participant

    Here's 1 way to check for user role https://nicola.blog/2016/03/30/redirect-after-logging-in-based-on-the-user-role/

    Or

    You can use

    current_user_can( $capability , $object_id );

    Tutorials for StudioPress Themes.

    November 27, 2017 at 8:34 am #214017
    verykindheart
    Member

    Wow, thanks for the extra information Brad. That helps a lot. I will try and get that working now. Thanks heaps.

    November 28, 2017 at 5:02 am #214045
    verykindheart
    Member

    Thanks a lot Brad. Got it to work perfectly.

    For anyone else interested, I've posted the code below.

    function child_header_title( $title, $inside, $wrap ) {
    if (current_user_can('subscriber')){
    $inside = sprintf( '%s', esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
    } elseif (current_user_can('contributor')){
    $inside = sprintf( '%s', esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
    }
    return sprintf( '<%1$s class="site-title">%2$s</%1$s>', $wrap, $inside );
    }
    add_filter( 'genesis_seo_title', 'child_header_title', 10, 3 );

    November 28, 2017 at 5:52 am #214047
    Brad Dalton
    Participant

    Here's another way to write the code.


    Tutorials for StudioPress Themes.

    November 28, 2017 at 6:27 am #214048
    verykindheart
    Member

    Brad that's beautiful! That's so much more succinct and there's no need to hard code the URL. Thanks very much!! You're a legend.

    November 28, 2017 at 7:11 am #214049
    Brad Dalton
    Participant

    You're welcome. A bit like poetry!


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Logo redirect based on user role’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble