There are various ways to do this, but I’ve recently addressed a similar problem by using cookies.
add_action( 'init', 'wpse_93797_cookie' );
function wpse_93797_cookie() {
if ( !isset ( $_COOKIE['wpse_93797_cookie_name'] ) ) {
// Do your stuff.
// Set your cookie so we don't do stuff the next time around.
// Note that 0 makes the cookie expire at the end of the user's browser session.
setcookie( 'wpse_93797_cookie_name', 'some-value-we-did-stuff-btw', 0, "https://wordpress.stackexchange.com/" );
}
}
Also maybe helpful:
Related Posts:
- Delete user from frontend
- What’s the correct way to add capabilites to user roles?
- Get multiple roles with get_users
- How to Merge Two Authors Into One?
- Whats the best way to share user data across multiple WordPress websites?
- User-edit role setting distinct from wp_capabilities? [closed]
- Delete all subscribers from wp_users and wp_usermeta a few thousand at a time
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- What the user_status column?
- Hide Admin Menu for Specific User ID who has administrator Role
- Problem with Hebrew characters in username
- Allowing an email as the username?
- Get the name of user who updated post
- Display edit link if post author is current user
- Change user’s display name programmatically
- Do not allow users to create new posts and pages
- Send activation email to user after signup [duplicate]
- wp_update_user() does not update user_data
- Sort get_users by custom field
- How to add follow functionality to multi-author wordpress site?
- Search multiple meta keys at once
- Get user input from a form
- Using get_terms for custom taxonomy in functions.php
- Redirecting user after updating profile?
- How to add new custom field in default add user form through plugin
- How to add wordpress username after url?
- ACF Upload Image in front-end with custom form
- User fields that can be edited by administrator?
- Admins can’t edit each other’s posts
- Update user_login to change username
- Multiple authors with different “author roles”
- Exclude subscriber users from user list
- Can’t add users in admin after copying database
- How can I check if a user’s email exists in the database
- Getting users by specific capability, not role
- Creating user in Firebase after WordPress user registration
- Exclude admin from user list
- How to display total number of post done by user, it should display at authors page wordpress [duplicate]
- Can i add password field into my wp registration form?
- User capability for editing their own comments
- Delete User via Frontend
- how to get WordPress admin user table columns name in my plugin
- Allow Contributors to Upload Files
- Limit a number of users returned from sorting users by latest posts function
- Will wordpress tools import do everything I need to copy one site to another
- Create Next and Previous Link to User orderby Last Name
- OAuth 2 and saving the authenticated user
- How to notify specific users when i’m posting/modifying a new post
- Limitations when adding new users
- User description only displayed for logged user
- Get an array of all users of a custom role type to send an email notification on post update
- Allow users to create post without logging in?
- How to get the count
- WordPress Password security related questions
- How to make Users sort in reverse order by default?
- Assign random (and unique) user meta upon registration
- About WordPress capabilities [closed]
- No more administrator roles / permissions after WordPress upgrade
- How to display text if profile fields are not filled?
- Load user by specific role
- Force users to use password with specifications
- Change user slug in Buddypress
- Creating a user from a different website
- Give users alternative/second avatar that is rectangle sized
- New User Save Filter
- Inserting current user ID into Post for Author
- Difference between is_user_logged_in and $_session[‘uname’]
- Add number of members to “Right Now” dashboard widget
- wp_generate_password sets password but can’t login using created password
- add class to element if user is not logged in [closed]
- How to verify which WordPress user requested the API in ASP .NET Core?
- How can admins to be notified of changes when users change their WP profiles?
- Can you Recover a WordPress User from a Backup
- wp-admin/users.php Add a column with last name
- 502 Error when edit some users
- How do I delete a wordpress user from giant database?
- get_users – Sort by a different meta_value than search criteria
- How to prevent deleteting specific user?
- Update user counts in admin interface
- How to get the username for a custom link
- To save user info on the same page by form submiting
- Groups roles & capabilities
- Button for users to upgrade their user role + Button to show current user role!
- Restrict Access to the User Profile
- How do I Limit the number of pages a non-subscriber can see?
- Username has been exposed
- How To Find The ID Of All Registered Users?
- How to order posts by the user_login that corresponds to a meta_value (which is a user id)?
- How to get only 1 role from user
- Retrieve New user’s ID
- Restrict access to certain dashboard pages based on user id
- remove an action hook function on a plugin from a theme
- how to show logged in members username in wordpress content
- hide woo commerce dashboard status and reports from woo commerce from specific users but display to other users
- User agent stylesheet distorting site [closed]
- WordPress – Security Question at Login from User’s Meta Data
- determine active user browser at the same time
- get Discussion setting in wordpress
- Set a minimal number for next user_id
- Remove My Account Menu items in Woocommerce based on user roles