How can i disable /wp-admin/customize.php redirect to login page when accessed directly?

I want to use customize.php if user logged in as admin, but when user is not logged in i want to disable the redirect to the login page.


1 Answer 1


to redirect all admin pages to home page when the user is not connected, try that

add_filter("login_url", function ($login_url, $redirect, $force_reauth) {

    if (!is_user_logged_in()) {
        $login_url = home_url("/");

    return $login_url;

}, 10, 3);

If you want to redirect only on the page "customize.php", you can add the condition at the "if".

  • not working for me.
    – user132099
    Nov 25, 2017 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.