Custom Restriction Message

To add a custom restriction message for content that is restricted by Group or Member Type, use the rcpbp_restricted_message filter located in includes/restricted-content.php.

Here is an example of how you would use the filter:

function my_restricted_message( $message, $is_group_restricted, $is_member_type_restricted) {
    if ( $is_group_restricted ) {
        return 'You must be a group member to access this content';
    }

    if ( $is_member_type_restricted ) {
        return 'You must be a certain member type to access this content';
    }

    // return the default message just in case something weird happened.
    return $message;
}
add_filter( 'rcpbp_restricted_message', 'my_restricted_message', 10, 3 );
Was this article helpful to you? Yes No

How can we help?