Liking
A like is a comment of type like on the post, by the member who liked it. Adding one also adds a BuddyPress activity item; removing one deletes both. Like comments are left out of the post’s comment count and never trigger comment notification emails. A post can be liked when it is publicly viewable, in any public status such as published or archived.
Logged-in members get a Like or Unlike button, a small form that posts back to the same page and then redirects, so reloading never likes twice. Nothing is ever liked by following a link.
Liking before logging in
Logged-out visitors get a Like link to the login page that returns them to the post. The link is the same for every visitor, so cached pages stay correct.
- Tapping it saves the pending like in the browser (IndexedDB database
lh-pending-actions, storeintents, keycurrent: one pending action at a time, newest wins), then goes to the login page. It expires after 15 minutes. - After logging in, on that post only, the like is sent to the REST API, the pending like is cleared and the button shows Liked with a brief Undo.
- Without JavaScript, or on another device, the return URL’s
lh_bp_pls-intent=likeshows a highlighted Confirm your like button instead. The parameter only changes the button; the member still has to press it.
REST API
Both routes take a post_id, need a logged-in user (with the wp_rest nonce for cookie authentication) and return post_id, liked and the post’s like count.
POST /wp-json/lh-bp-pls/v1/like/: 409 if already liked, 404 if the post can’t be liked.POST /wp-json/lh-bp-pls/v1/unlike/: 409 if not liked.
Hooks
lh_bp_pls_init_plugin: return false to stop the plugin loading.lh_bp_pls_intent_ttl: seconds a pending like stays valid (default 900).lh_bp_pls_return_block_name: name of the Like button block.lh_bp_pls_like_action: text of the BuddyPress activity item.
Requirements
BuddyPress and WordPress 6.7 or later. The front end uses the idb-keyval library: the shared copy from LH idb-keyval when that is active, otherwise the plugin’s own bundled copy.

