Eddie
Eddie

Reputation: 59

Wordpress Logged Out Users

I'm trying to add a link in my header.php file that disappears after a user logs in...So the link only shows for logged out users...Can anyone help with this?

Upvotes: 2

Views: 1023

Answers (2)

Arvind Pal
Arvind Pal

Reputation: 533

global $user_ID,$current_user;
get_currentuserinfo();
if ( $user_ID ) { .. }

You can get the current user login.

Upvotes: 0

Eric Witchin
Eric Witchin

Reputation: 574

In your header.php file place this code

<?php if ( !is_user_logged_in() ) { ... } ?>

Place your link inside the { } where the ... is.

See Function Reference - is_user_logged_in() and its related functions for more information.

Upvotes: 4

Related Questions