Support

Account

Home Forums Front-end Issues Blocking access to wp-admin while using a front-end form Reply To: Blocking access to wp-admin while using a front-end form

  • Here’s what I’m doing, and I can confirm that it works in Safari with ACF 5. DOING_AJAX is a global constant… is there a reason why the value needs to be confirmed? I’m just making sure that it’s set to something other than FALSE.

    add_action( 'admin_init', 'redirect_admin' );
    function redirect_admin() {
    	if ( ! current_user_can( 'manage_options' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ) {
    		wp_redirect( site_url() );
    		exit;
    	}
    }