Title: Adding Admin only nav links.
Last modified: August 18, 2016

---

# Adding Admin only nav links.

 *  [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/)
 * I’m looking to add a link to my blog nav where only I, the Admin, can view the
   link when logged in, just like the Site Admin link that shows up when I’m logged
   in. I can’t find anything online that mentions how to do this. Anyone knows?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550133)
 * You can use either:
    `if ( current_user_can('edit_post') )` or `if ( $user_ID)`
   There are some differences, so check them out first.
 *  Thread Starter [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550141)
 * Thanks but I’m not sure what the differences are or how to implement the code.
   Could you give me more details?
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550147)
 * Try
 *     ```
       <?php if ( $user_ID ) { ?>
       <a>...</a>
       <php } ?>
       ```
   
 * The link will show for any logged in user.
 *  Thread Starter [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550182)
 * Thanks. Now how do I make it so it’s only visible to the admin instead of every
   logged in user?
 *  Thread Starter [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550188)
 * I’m getting the following error when I drop in that code:
 * **Parse error: syntax error, unexpected $end in /home/16094/domains/aisleone.
   net/html/wp-content/themes/default/sidebar.php on line 119**
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550189)
 * Then try this:
 *     ```
       if ( current_user_can('edit_posts') ) { ?>
       <a>...</a>
       <php }
       ```
   
 * Look for the `<?php ... ?>` tags. You can paste this somewhere between them, 
   or use them at the beginning and the end.
 *  Thread Starter [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550199)
 * I dunno dude it’s not working. Im still getting that parse error. Thanks for 
   the help though. I appreciate it.
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550203)
 * Where about in sidebar.php are you trying to put this? You can paste it including
   <?php … ?> just before the last </div>, line 67.
 *  Thread Starter [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550204)
 * I’m putting it in here:
 * <?php wp_register(); ?>
 * **RIGHT HERE**
 * <?php wp_loginout(); ?>
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550232)
 * It should work there… Did you surround it with `<?php ... ?>` like that:
 *     ```
       <?php if ( current_user_can('edit_posts') ) { ?>
       <a>...</a>
       <?php } ?>
       ```
   
 *  Thread Starter [yots](https://wordpress.org/support/users/yots/)
 * (@yots)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550249)
 * That worked man thanks! I probably typed it in wrong.
 * Thanks again.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Adding Admin only nav links.’ is closed to new replies.

## Tags

 * [links](https://wordpress.org/support/topic-tag/links/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 2 participants
 * Last reply from: [yots](https://wordpress.org/support/users/yots/)
 * Last activity: [19 years, 1 month ago](https://wordpress.org/support/topic/adding-admin-only-nav-links/#post-550249)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
