Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Menu Navigation Link That Can Pass PHP WordPress


Not sure if this is possible but here goes...

Is it possible to have a navigation link (say on the main nav bar) that can pass php??? Maybe a custom walker???

I have the following scenario;

I have custom meta fields that are updated by users on the Wordpress backend...

These fields are displayed on the front end in the author.php page... This works fine...

I have a menu link for the user to update their profile, however I would also like the user to have the ability to view their profile on the front end... I would like this to take the form of a menu link on the main nav bar, say "View Profile"...

So the menu link would need to point to say depending on the user...

The "Menu Link" would need to contain logic to say,

if the user is logged in
get their profile id
and take them to their author page, i.e

Any solution to this problem would be greatly appreciated...


Answers (2)


Just Me answers:

something like

global $current_user;
$current_user = wp_get_current_user();
$id = $current_user->ID;
if ($id > 0) {
echo "<a href=$id>View Profile</a>";

Sean Gartlan comments:

Yes ok that makes sense, however how do I integrate that concept into the menu structure within Wordpress??? See attached image...