Please or Register to create posts and topics.

Add Profile Page to Wordpress Menu

Hello,
how can add to my wordpress menu Profile page link page?
need a shortcode?
How can add a dynamic url base on user?

Best Regards

Riccardo

Hey @rgt,

you can just use the following snippet:

add_filter( 'nav_menu_link_attributes', 'asgaros_menu_profile', 10, 3 );

function asgaros_menu_profile( $atts, $item, $args ) {
    if (!strpos($atts['href'], '--asgaros-profile--')) {
        return $atts;
    }

    $user = wp_get_current_user();
    $profile_link = home_url() . "/forum/profile/" . $user->user_nicename;
    $atts['href'] = $profile_link;

    return $atts;
}

After adding this code you only have to add “–asgaros-profile–” to the URL of the menu entry and it will be replaced with the profile link.

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

@jiuer7845, you are a very unwelcome form of internet life.  Please get a real job, or crawl in a hole and don’t come out.

Asgaros has reacted to this post.
Asgaros