Skip to content

Instantly share code, notes, and snippets.

@manchumahara
Last active December 22, 2017 10:20
Show Gist options
  • Save manchumahara/d1f234358e1c362d561a516b9958ee03 to your computer and use it in GitHub Desktop.
Save manchumahara/d1f234358e1c362d561a516b9958ee03 to your computer and use it in GitHub Desktop.
Check if the post is bookmarked by user (user id or by current logged in user) https://codeboxr.com/documentation-for-cbx-bookmark-for-wordpress/
//check if the current user has bookmarked any post
if(class_exists('CBXWPBookmarkHelper')){
$current_user = wp_get_current_user();
$user_id = $current_user->ID ;
global $post;
$post_id = $post->ID; //if you are trying outside of
$bookmark_by_user = CBXWPBookmarkHelper::isBookmarkedUser($post_id, $user_id); //true or false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment