Quantcast
Channel: User Michael - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 44

Answer by Michael for Change logo url based on WP user role

$
0
0

try this filter for the logo url link; adapt your landing page links:

function user_defined_logo_url( $html ) {$cur_user = wp_get_current_user();$user_role = $cur_user->roles[0];$logo_url = esc_url( home_url( '/' ) );switch( $user_role ) {case "cc1":        $switch_logo_url = esc_url( home_url( '/' ) . 'landingcc1' );       break;case "cc2":        $switch_logo_url = esc_url( home_url( '/' ) . 'landingcc2' );       break;case "cc3":        $switch_logo_url = esc_url( home_url( '/' ) . 'landingcc3' );       break;default:        $switch_logo_url = '';  }if( $switch_logo_url ) $html = str_replace( 'href="'.$logo_url, 'href="'.$switch_logo_url, $html );return $html;}add_filter( 'get_custom_logo', 'user_defined_logo_url' );`

Viewing all articles
Browse latest Browse all 44

Trending Articles