It depends how you want to uniquely identify users. Some options to uniquely identify people might be the:
- The WordPress User ID. If people are logged in then using their WP User ID is a good option.
- The WordPress session ID. This is unique to the session; People will get a new session after some amount of time, and if they change browser or clear their cache, etc.
- The Browser User Agent. This is another option that will change less frequently but still might change, but will solve your problem quickly
Whatever you choose, you can simply change both of these lines in your code to user more specific method. E.g. I would suggest trying IP + User Agent:
$user_IP = $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'];
This will mean each like is then unique to IP plus browser user agent string, which should solve the problem you stated.
Related Posts:
- Where the Nickname is being used in WordPress
- Confusing problem with displaying message recipient metadata
- Building a scalable WordPress favouriting plugin – one serialised meta value array or many meta records
- delete_user_meta Delete one value out of array
- Upload files programmatically to users
- Current user in plugin returns NULL
- update_user_meta add value on the top on existing value
- Set user ID at time of wp_create_user
- Average Account Age
- How to get current post user id
- New User Form – Custom Menu Page
- Modifying Author Link to add Author Meta in URL
- How can I change the meta_key for a particular piece of information?
- Shortcode to update user meta
- How to get all posts belongs to a user between a certain date
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Search users with custom meta data
- WordPress /users/me endpoint request forbidden
- Disable Author Archive just for certain roles in bulk
- Auto populate a user custom field from another user custom field
- Access remote SFTP server via WordPress login?
- User updating their profile wipes my custom fields
- How To Export User’s Custom Fields in CSV or XLSX
- Get all user meta_keys and then group users by matching values
- Does a plugin’s “main” file need to be named the same as the folder containing it?
- Symlinked plugin directory doesn’t appear in Admin
- How do I unlock a post programmatically?
- Customizing subject in comment notification e-mails
- User-Specific Timezones? Hack? Plugin?
- enqueue script only if it is not already enqueue
- How can I limit functionality in one version of a plugin?
- Plugin child folder?
- merging an array to an existing array using add_filter
- Is it possible to set up multistore in Woocommerce? [closed]
- Displaying a Welcome Message to a Woocommerce User
- Retrieving plugin options value saved through setting
- How to ‘clone’ a wp plugin to make small changes
- Simple ajax call not working in wordpress plugin
- How to save post change url youtube link?
- __callStatic method handler passed to add_action causes bug in PHP
- New databes tables with – WooCommerce – for developers [closed]
- Plugin-generated pages use Not Found or Pages Archive templates?
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- How can I copy all users to newly created site on a multisite network in WordPress?
- Perform internal redirect in WordPress?
- How to prevent plugins from loading jQuery
- Display custom content using page.php from theme
- WordPress error: Options page Setting_ not found in the allowed options list
- What is wordpress way to access a plugin’s classes/models to load custom post type data?
- Associate multiple email addresses with the same user account, so they can log in with either
- Translations for my plugin don’t show up
- flush_rewrite_rules() not working with update_option_{$option}
- Update a user profile via frontend
- How to ignore extra whitespaces in translation functions like _e?
- How does translation (gettext) work for translating config file of plugin?
- Is there a better way of handling AJAX requests in WordPress?
- how to add a comment button to be displayed only for the posts in the home page [closed]
- Plugin permissions for Editor role
- The “Child Pages Shortcode” plugin, block template
- using wp_footer hook in a plugin
- How to get a custom page through plugin?
- How to data add to table when update post wordpress? when we clicked!
- can’t unzip file
- WooCommerce – I want to add functionality of one plugin to another plugin — best approach?
- Want to create custom design of progress indicator in wpforms
- Check if theme supports sidebar
- Change plugin descriptions
- How to display the custom post related blog by category?
- WP Forms not displaying,becomming an fatal error
- How to create a page with the selected template after activating the plugin
- I enabled debugging but I still get the same message: There has been a critical error on your website
- wp_mail function not working in WordPress Plugin Boilerplate
- When/where would want to attach other classes to the base class in a WordPress plugin?
- Using foreach loop for `$instance` of form and update array widget iteration
- How to call a function from inside class to outside class
- Use Case: Multiple Shipping Methods per Order
- Showing how many times is plugin activated or deactivated
- Could someone maybe point me in the direction of a decent tutorial on how to create a wordpress plugin that is compatible with another plugin please?
- Custom plugin which downloads updates from custom endpoint, extracts new version zip into a new name
- wp meta_query meta_value compare =REGEXP delimited by space
- Create shared actions for admin and users with plugin bolierplate
- How to insert variable which contain array value in wp_options table?
- How to Insert images in WordPress using code
- shortcode which is introduced into entry the blog, and appears in side bar
- Multiselect value in wp_query
- How to Overwrite validate_plugin function
- how to load a file from a plugin when a url is passed
- Is it possible to cancel a post status transition?
- Form data to wordpress DB
- Register additional wp plugin directory
- WordPress User Portal
- How to include a custom thumbnail with my WordPress plugin?
- How to display blog posts only authored by the administrator
- Send email notification when meet the condition
- Create Unique and Customized User ID for Website Members in WordPress
- Cannot edit Sidebar in any theme in wordpress
- how to update wordpress plugin programmatically using plugin path
- Testing Plugin – Install plugin dependencies in testing enviroment
- Email notification when registred user clicks a link/visits page
- Automatically download dependent plugins from WordPress.org?