Wordpress use management

linkaiyi
Follow

check user status

is_user_logged_in() //if user is logged in
is_admin()// if user is admin
current_user_can('administrator') //user has certain role
get_user_meta( $user->ID, '_is_cool', true ) //check user meta customization

get url

get_option('siteurl') //index page
get_admin_url() //admin url
wp_redirect(home_url()) //redirect
wp_login_url(get_option('siteurl')) // login url with next path
Object has 0 attachments

Was this article helpful?

This article is viewed 45 times!

Recent Viewed Articles

0 Comments

Leave a Comment

Support