I want to create a link that will change based on the user clicking the link.

The User will be signed in and be accessing their "storefront". I want to have the link be a link to their specific storefront

for example


where username would change based on the user clicking I'm fairly new to this so please explain like I know nothing

Thanks! Ben

1 Answer 1

$current_user = get_userdata( get_current_user_id() );
echo 'http://www.mywebsite.myweb/storefront/' . $current_user->user_login;
  • Thank you very much. Would I flank this with php open and closers or just put it in plain.
    – Galindan
    Mar 13, 2018 at 1:01
  • Depends on your surrounding code you can always prefix both lines with <?php and suffix them with ?>.
    – Beee
    Mar 13, 2018 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.