Tell us what you are trying to do? I added code to redirect non-admins to the home page (ie prevent them from accessing admin dashboard).
Below is the code for redirect.
function redirect_non_admin_users() {
if (!current_user_can('administrator') && is_admin()) {
wp_redirect(home_url());
exit;
}
}
add_action('admin_init', 'redirect_non_admin_users');
This stops the form from working (will not submit ) in AJAX. Is there a reason for this?
Is there any documentation that you are following? no
Is there a similar example that we can see? no
What is the link to your site? hidden link
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Rather using such custom code - what if you try to use plugin to restrict user:
- https://wordpress.org/plugins/restrict-user-access/
You can find any plugin that suits your requirement:
- https://wordpress.org/plugins/search/restrict+user/
These plugins is not what I was looking for, I was trying to see why the code impacts it, you can close the case no worries. Toolset should have a forwarding/redirect options for user types etc in my view.