Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exclude subscribers from a custom point type.
/**
* Exclude Subscribers from Specific Type
* @mycred
* @version 1.0
*/
add_filter( 'mycred_exclude_user', 'mycredpro_exclude_wp_subscribers_from_points', 10, 3 );
function mycredpro_exclude_wp_subscribers_from_points( $exclude, $user_id, $mycred ) {
// Only applicable for a specific point type
if ( $mycred->cred_id != 'mycustomtype' ) return $exclude;
// Exclude subscribers
if ( ! user_can( $user_id, 'edit_posts' ) ) return true;
return $exclude;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.