Modify hard-coded conditionals for roles to custom roles

First, your check code works, and takes this pattern: if ( $current_user->data->wp_capabilities[‘hardcoded role name’] ) { $role=”hardcoded role name”; } So lets swap the hardcoded role string out for a variable called $role_name ( you could call it something else if you want ). The check for a role name is now: if ( $current_user->data->wp_capabilities[$role_name] … Read more

Disable The Events Calendar plugin from loading its scripts

I was successfully able to disabled The Events Calendar plugin for users that are not logged in by using only filters (see below). The dequeue_tec_scripts function dequeues scripts loaded by the plugin. The restricted_access_template function, redirects the user to a custom template named ‘restricted_access.php’ or ‘404.php’ if the template file is not found. I haven’t … Read more