WP Check if specific user is logged in

<?php add_action('admin_init', 'wp_admin_check_username'); function wp_admin_check_username() { $user = wp_get_current_user(); if($user && isset($user->user_login) && 'username_to_check' == $user->user_login) { // do stuff } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.