Snippets: Use Local Scroll for the Top Bar Social Email Link

add_filter( 'wpex_topbar_social_link_attrs', function( $attributes, $site ) {
    if ( 'email' === $site ) {
        $class = $attributes['class'] ?? '';
        $attributes['class'] = trim( $class . ' local-scroll-link' );
        $attributes['target'] = '';
    }
    return $attributes;
}, 10, 2 );

Snippet Type: PHP

Posted Under: Top Bar

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)