Skip to content

Instantly share code, notes, and snippets.

@contemplate
Created January 15, 2024 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save contemplate/b0be05bd2b72510e12e5462a75118f35 to your computer and use it in GitHub Desktop.
Save contemplate/b0be05bd2b72510e12e5462a75118f35 to your computer and use it in GitHub Desktop.
AffiliateWP: limit leaderbaord to specific affiliate group
add_filter( 'affwp_leaderboard_defaults', 'group_affwp_leaderboard_defaults', 10 );
function group_affwp_leaderboard_defaults( $defaults ) {
$defaults['connected_to'] = array(
'get_connectable' => 'affiliate',
'where_connectable' => 'group',
'where_id' => 2, // ID of the affiliate group
'where_group_type' => 'affiliate-group',
);
return $defaults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment