Hi,
I am trying to redirect an admin url with page parameter (plugins options page) for non admins
I tried with this
function redirect_options_page() {
if (!current_user_can('update_core') && $_SERVER['PHP_SELF'] == '/wp-admin/admin.php?page=WP-Optimize'){
wp_redirect(admin_url('/') );
exit;
}
}
add_action('admin_init', 'redirect_options_page');
But this is not working and does not take me to my desired location.
I am pretty sure I am missing something.
Thanks