Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Redirect admin url with page parameter

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #237203
    Ayanize
    Participant

    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

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.