10 November 2011

Hide WordPress Admin Link

If you're editing or building a WordPress theme, and want to hide the 'Admin' link, the solution is very simple:

<?php if (current_user_can("manage_options")) : ?>
       <a href="<?php echo bloginfo("siteurl") ?>/wp-admin/">Admin</a>
<?php endif; ?>
This will show a link saying 'Admin' if an admin is logged in, for all other users and logged-out users nothing is displayed.