Skip to content

Instantly share code, notes, and snippets.

@ThemeGravity
Last active October 29, 2019 10:38
Show Gist options
  • Save ThemeGravity/451f2fcf7bea009c12801f133222f3d6 to your computer and use it in GitHub Desktop.
Save ThemeGravity/451f2fcf7bea009c12801f133222f3d6 to your computer and use it in GitHub Desktop.
If Menu custom rule for MemberPress
<?php
function mepr_custom_rule_menu_condition( $conditions ) {
$conditions[] = array(
'id' => 'memberpress-rule-50', // unique ID for the rule
'name' => __( 'Memberpress access rule 50', 'i18n-domain' ), // name of the rule
'condition' => function( $item ) { // callback - must return Boolean
return current_user_can( 'mepr-active','membership: 50' ); // paste MemberPress condition here and returns it
}
);
return $conditions;
}
add_filter( 'if_menu_conditions', 'mepr_custom_rule_menu_condition' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment