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
- How to add usermeta for existing users when user profile is updated
- Custom characters of tinymce editor are saved as question mark
- Can’t create tables with my plugin
- Custom Fields for Page Edits
- More gentle way to hook WordPress custom url
- Make get_permalink() work outside the Loop using filters
- Integrating Custom Database with WordPress
- Creating teams of users in WordPress
- Apply html elements in php statement
- Custom Post Type template for homepage
- How to get a custom page through plugin?
- Can we give Pending as a Role to wp_insert_user?
- How do i ‘deactivate’ a plugin only on a certain page template?
- WordPress plugin for Limited days user
- How to display results from a data table with an encrypted user id?
- How to reduce Apache connections caused by plugins?
- How to add custom function to pluggable.php
- How do i specify a url to which to redirect the user after he logs out from facebook?
- WordPress Post HTML after Posting
- How to append new form elements in “Add New” form of Users in WordPress admin panel?
- Need to add/remove group of options and display them as rows
- Settings options not showing up on Sub Menu page in WordPress plugin
- How to deactivate my plugin upon deactivation of NextGen
- Yoast SEO Plug In and my Theme duplicating code. Need some feedback on what to do? [closed]
- My plugin does not install correctly if a previous version is still installed
- Ajax request sends url rather than data
- How can I create a page as a draft from my plugin?
- Custom Module, Extending WP with a Plugin?
- How do I remove all traces of a plugin?
- How to get values from network settings panel?
- How do I reliably find a URL to a script or other file?
- How do I profit from a Plugin?
- How to add captcha to publish widget
- Plugin privelages for “editors”
- Adding a jQuery modal dialog to the admin area
- using wp_cache in plugin
- Pluging with content for a specific page or post
- How to automatically activate users after registration without activation email?
- Creating a plugin that will display text on every page
- I cannot include a file in my plugin settings page
- How to get Recent Post From Each Category with Thumbnail?
- Shortcode not displaying HTML within the function
- Paypal Framework
- help intercepting save_post through plugin
- unregister a sidebar widget
- Janrain/Simple Modal under Redirected Domain
- best way to run a php script away from the template?
- Custom Post Type, Custom Columns List
- XML Sitemap Generator and 404 problem
- auto activate plugin when theme is active
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- Should I use the action in the plugin’s main file?
- Is it possible/advisable to set last stable version to previous version?
- How to add logo to a WordPress Custom Plugin?
- Themes conflicts and overrides my WordPress Support widget Plugin styles
- How to make sure settings are not lost when plugin is updated?
- Does WordPress do any internal caching if no plugin installed?
- Use a custom block in another block
- Seperate plugin and theme files
- WordPress Plugin- How to Insert Html&JS code in specific Page and specific Div
- Xamp installed local wordpress not allowing to publish or install plugin
- How to data add to table when update post wordpress? when we clicked!
- How to make a Product page without ordering and database
- can’t unzip file
- How Can i import plugin option?
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- wp_options not returning value for logged out users?
- Pass PHP variable to javascript
- WooCommerce – I want to add functionality of one plugin to another plugin — best approach?
- WordPress cron job running more than once
- Gutenberg default attributes are empty when accessing in edit
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- How can i export and import my plugin option WordPress
- How to Add text value in Automatically in this conditions?
- Table of contents (TOC) plugin is not showing header tag