You can do this.
<?php if (is_user_logged_in()) : // user is logged in ?>
<button>Log Out</button>
<?php else : // user is not logged in ?>
<button>Log in</button>
<?php endif; ?>
Related Posts:
- get_userdata by username
- WordPress Login Customization for External Authentication
- WordPress REST Api: update user
- How can I display Only the first Array/Object?
- The same session information for peer users on two different WordPress servers
- Replacing the WordPress password validation
- WordPress auto login after registration not working
- Allow up to 5 Concurrent Login Sessions
- Retrieve all users from wordpress database via REST/JSON API
- How can I get users email (and additional data) from the rest API?
- Why does is_user_logged_in() return false after redirect from another site?
- Basic auth WordPress REST API dilemma
- Get user info outside WordPress
- Multisite functions to communicate with individual site functions
- How can I secure a WordPress blog using OpenID from a single provider?
- Is it possible to get a user with just the password field?
- Redirect after login based on user role (custom login page)
- Check for user meta data at Login
- Redirect User to Homepage if no other redirect is specified
- My custom page template with is_user_logged_in() does not detect that I’m logged in
- Use phpbb user database for WordPress
- WordPress to use Drupal users’ credentials
- Authenticate with a Rails app?
- Share user table from WP with Drupal
- How can I allow password reset based on logins containing the @ character?
- A way to count logged in users and display count?
- stop login if user_status equal zero
- How do i make my wordpress website private?
- Redirect user to login before viewing custom post
- Change the user_login at registration
- Max no of simultaneous active sessions for a single user
- What would be the best way to implement Magic Link logins in WordPress?
- Rest API code to get ID of current user not working: get_current_user_id() gives 0
- WordPress API for search
- When I try to login in wordpress it is showing “USER Doesn’t Exists”
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- Redirect subscribers to last viewed page after log-in
- Is there a way to identify a user in a custom REST API method? [duplicate]
- wordpress disable login for unverified user
- Reset Password policy
- Rewrite Rules and Login Issue
- How can I authenticate user credentials against a WordPress instance?
- Rest api return all users (even without content) to all users
- Is possible to allow user to login with different role?
- Use WordPress Login for a non-wordpress site
- Best option to implement external register/login to WP from self-made API
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- No user found when using REST API
- Is there any action /filter hook I can use to disable login for some user role?
- How to check User Role and redirect to specific page according to Role when login in WordPress?
- REST API: wp_get_current_user not working on second call
- Display video on homepage for users who have not logged in
- How do you manage your pages or functions that require logged-in users?
- Is it possible to create new user from external form using REST API?
- How can i login with user’s password in WordPress being an admin?
- Delete a user from frontend
- Check if user is logged in via JS? [duplicate]
- Use members from 1 site on another one
- Can I edit the database to change a login?
- how redirect users to custom login page when “login to reply” is clicked? [duplicate]
- User(s) already exists show error please provide a valid username
- wp_generate_password sets password but can’t login using created password
- add class to element if user is not logged in [closed]
- User can’t search himself on rest api
- How to verify which WordPress user requested the API in ASP .NET Core?
- Need to use WordPress page as authentication for different service
- Restricting wordpress login sessions for a web app
- change user password REST API
- Getting user data via ajax
- Get UserInfo from WordPress
- How to connect wordpress user with my own APP user?
- Call WP Rest-Api to GET /users/me returned NOTHING in console
- How to change default username field after login
- How to customize user rest api?
- REST API list_user
- How to update a user with REST API v2 knowing only the username?
- Set logged in user based on API response
- WP users cant reset password
- $user_login is not working if author has only 1 post
- REST_query_vars for users
- Specific Content on pages based on user
- user and usermeta table not found
- custom login form, guide me
- Changing user_login ends current session
- Current User Seeing Another Logged In User Info
- Redirect based on log-in status per JavaScript
- Securely log in a user without a password using a link?
- Integrating Facebook Registration (and Login) on a WordPress page
- How-To: Get meta data from the users last order in woocommerce
- WordPress C# User Login
- Why does a super admin on multi site get a rest_user_invalid_id error code when requesting user details through REST?
- WordPress – Security Question at Login from User’s Meta Data
- determine active user browser at the same time
- How to track all users logged into a site?
- Cant edit profile from frontend
- How to authenticate/verify login credentials & check for user meta without logging in?
- Recognize logged WP user in existing REST API
- Login and register by API
- Unable to retrieve Users (Not logged in) through WP Rest API
- Can’t retrieve user email address with REST API