Skip to content

Instantly share code, notes, and snippets.

@someguy9
Created June 25, 2019 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someguy9/9b8d93f59adae835ce8f0b2c6b1e8ee4 to your computer and use it in GitHub Desktop.
Save someguy9/9b8d93f59adae835ce8f0b2c6b1e8ee4 to your computer and use it in GitHub Desktop.
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