Get multisite "admin_url" into redirect.
-
I’m setting up ajax login from home page and redirect to “site.com/username/wp-admin” but cannot get the url right.
function ajax_login_init() { global $mk_options; $theme_js_hook = ($mk_options['minify-js'] == 'true') ? 'theme-scripts-min' : 'theme-scripts'; wp_localize_script( $theme_js_hook, 'ajax_login_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'redirecturl' => site_url(), 'loadingmessage' => __( 'Sending user info, please wait...' , 'mk_framework') ) ); } if ( !is_user_logged_in() ) { add_action( 'wp_footer', 'ajax_login_init' ); } add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' );Only thing that matters is ” ‘redirecturl’ => site_url(),” and i need to replace the “site_url()” with “http://site.com/username/wp-admin/” but everything I try does not work.
I think what I need is something like this
'redirecturl' => 'http://site.com/' . $current_user->user_login . '/wp-admin',
But this does not work, as it cannot detect username, and redirects to http://site.com/wp-admin
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Get multisite "admin_url" into redirect.’ is closed to new replies.