How can I allow users to sign up but prevent them from accessing the WordPress backend?

  1. Check for administrator user

    current_user_can ( ‘manage_options’ )

  2. Remove the admin bar for non-administrators

    show_admin_bar ( false )

  3. Redirect non-administrators to another page

    wp_redirect ( site_url( “https://wordpress.stackexchange.com/” ), 302 )


Putting it all together

function wpse_20160318_user_checks() {

    // ignore administrators
    if ( ! current_user_can( 'manage_options' ) ) {

        // ignore these events
        if  ((   defined( 'DOING_AJAX' )   && DOING_AJAX )
            || ( defined( 'DOING_CRON' )   && DOING_CRON )
            || ( defined( 'WP_CLI' )       && WP_CLI )
            || ( defined( 'REST_REQUEST' ) && REST_REQUEST )

        ) {
            return;
        }

        if ( is_admin() ) {

            // redirect if on the dashboard / back-end to a front-end page
            wp_redirect( site_url( "https://wordpress.stackexchange.com/" ), 302 );
            exit;

        }
        else {

            // remove admin bar on front-end
            show_admin_bar( false );
        }
    }
}

add_action( 'init', 'wpse_20160318_user_checks' );