Like button for WordPress without login
Published 4 min read
WordPress's comment system has a guest mode: visitors can leave a comment without an email address if the site allows it. The like button does not work the same way. The Like button on WordPress posts comes from Jetpack, and each like is tied to a WordPress.com account. A visitor who is not logged in can see the count but cannot add to it.
For sites where the goal is simple affirmation, the account requirement is the whole obstacle. A cookie-based counter stored in post meta removes that requirement. It is not fraud-proof; anyone who clears their browser cookies can like a post twice. For most community blogs, documentation sites, or staff intranets, the occasional duplicate vote matters far less than the barrier of creating an account.
Why the Jetpack button stops at the login prompt
Jetpack's Like is not a WordPress feature; it is a React component that reads and writes through a WordPress.com API endpoint. The click goes to wordpress.com infrastructure, not to your hosting server. The like count is stored on wordpress.com, deduplication uses a WordPress.com identity, and the button is interactive only for users who are logged into a WordPress.com account.
The benefit of that design is real deduplication: one account, one like, across every browser and device. The tradeoff is that everyone who wants to click needs a WordPress.com account, which is the same barrier as asking them to register on your site.
What a 30-day cookie can and cannot block
A cookie-based approach stores the like state in the browser, not against an identity. When a visitor clicks, the plugin checks for a cookie named after the post ID. If the cookie is present, the click is ignored. If it is not, the post meta count increments and the cookie is set to expire in 30 days.
One browser and one device means one like per month. Clear the cookies, switch to a private window, or use a different device, and the limit resets. For a site where the count is decorative or signals rough engagement, this is a reasonable tradeoff. For a site where likes determine which posts surface in a feed, the right answer is requiring an account.
Turning the count into a sortable post list
The like count is stored as an integer at the post meta key _post_like_count. Because it is standard post meta, WP_Query can order by it: set meta_key to _post_like_count and orderby to meta_value_num, and you get posts sorted by engagement. A popular-posts sidebar widget, a homepage section featuring the five most-liked articles, or a dedicated archive page sorted by count are all straightforward queries against that value.
The plugin also adds a sortable Like Count column to the Posts admin list screen. Clicking the column header sorts posts by the meta value. Posts with high traffic but low like counts show up quickly, which can flag pages worth revisiting before writing something new.
What you get
Included
- [post_likes] shortcode rendering a heart button with the current count
- Cookie-based deduplication, one vote per browser per 30 days
- Like count stored in post meta at _post_like_count
- AJAX increment on click with no page reload
- Sortable Like Count column in the WordPress Posts admin screen
Not included
- Per-user attribution: tracking which logged-in user liked which post
- Cross-device or cross-browser deduplication
- Dislike buttons or emoji reaction sets
- Notifications when a post reaches a like threshold
- Unlike or vote removal
Jetpack does the things on the right. This build covers the part most sites use.
Questions
Can a visitor undo a like?
No. The button only increments. Clearing browser cookies would allow clicking again, but there is no remove path in the plugin.
Build it in Steem
The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.
Read the prompt (90 words)
Build a WordPress plugin that adds a like button to posts. Add a [post_likes] shortcode that renders a heart button and the current like count. When clicked, send an AJAX request: check for a cookie named steem_liked_{post_id}; if set, return the current count unchanged. If not set, increment the _post_like_count post meta value, set that cookie to expire in 30 days, and return the new count. Update the button display without a page reload. Add a Like Count column to the WordPress Posts list screen, sortable by that column's value.
Steem