Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:02:12+00:00 2026-06-04T02:02:12+00:00

So I currently have WordPress with some navigation links along these lines: Link 1

  • 0

So I currently have WordPress with some navigation links along these lines:

Link 1 | Link 2 | Link 3 etc.

Two things, first I’m trying to add a link inbetween Link 2 and Link 3. I am using this code, but it adds the link to the end of the unordered list. Is there a way to specify it’s position?

    add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {

        $items .= '<li><a href=#">Test Link</a></li>';
    return $items;
}

Secondly, I would like this new link to have a dynamic URL containing the users ID. I’ve tried looking up information regarding get_currentuserinfo(); with wordpress, but I can’t seem to find a way to include it in the function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:02:13+00:00Added an answer on June 4, 2026 at 2:02 am
    1. You can specify the filter priority with add_filter, try to play with the value 10 until your nav item is in the right position.

    2. You need to set a global variable $current_user before calling the function.

    Code

    global $current_user;
    get_currentuserinfo();
    
    echo 'Username: ' . $current_user->user_login . "\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an encoded footer file for a wordpress file I want to
I currently have a single web server hosting multiple WordPress sites which use W3TC.
I have a wordpress application thats currently the only application on the domain. Now
I have to add image as attachment in post in wordpress. Currently image is
I made some pages in Wordpress and displayed a navigation so the user can
I am trying to create dropdown menu for Wordpress theme and having some silly
I have been asked to convert an entire site that is currently using wordpress
I am currently maintaining some Wordpress MU installations ( v2.9.x ) I want to
I'm trying to add some functionality from a plugin I have made into a
I have a wordpress site that is currently running in a subdirectory of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.