Month: May 2016

Check user meta data when user login in WordPress

For our customization want to check user meta when user login in wordpress then place the following snippet in functions.php within your theme folder!.

function check_user_meta_data($user) 
	$st=get_user_meta( $user->ID, 'user_status', true);
	 if ($st != 'active') {
        $user = new WP_Error( 'denied', __("ERROR: Account Not Active..") );
    return $user;
add_action('wp_authenticate_user', 'check_user_meta_data', 10, 2);

Have any doubt, then comment here!