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.
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.
lh-pending-actions, store intents, key current: one pending action at a time, newest wins), then goes to the login page. It expires after 15 minutes.lh_bp_pls-intent=like shows a highlighted Confirm your like button instead. The parameter only changes the button; the member still has to press it.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.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.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.