Last active
August 12, 2019 15:51
-
-
Save garvs/56fdb4abe06a856c964a to your computer and use it in GitHub Desktop.
Additional option for User Role Editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'ure_role_additional_options', 'add_prohibit_access_to_admin_option', 10, 1 ); | |
function add_prohibit_access_to_admin_option($items) { | |
$item = URE_Role_Additional_Options::create_item( 'prohibit_admin_access', esc_html__('Prohibit access to admin', 'user-role-editor'), 'init', 'prohibit_access_to_admin' ); | |
$items[$item->id] = $item; | |
return $items; | |
} | |
function prohibit_access_to_admin() { | |
if ( is_admin() && !wp_doing_ajax() ) { | |
wp_redirect( get_home_url() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details here: https://www.role-editor.com/documentation/hooks/ure_role_additional_options/