Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple code using the built in WP function that checks if you a user is logged into WordPress.
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, logged in user. <a href="'.wp_logout_url().'">Click here to logout</a>.';
}else{
echo 'Please login by <a href="'.wp_login_url().'">clicking here</a>.'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.