Is there any filter to disable the total fronted in WordPress

By Killing WP on non-admin Pages

The below code will determine whether you are on a front-end page or not, and kill WP if you are.

add_action( 'init', 'my_function' );

function my_function(){
    if ( ! is_admin() ) wp_die();
}

Note that this might also affect AJAX requests ( untested ) so you might want to add wp_doing_ajax() to your conditional too.

By Redirecting the Users to Dashboard

Same as above, you can check if you are on admin and redirect the users to back-end from front-end.

add_action( 'init', 'my_function' );

function my_function(){
    if ( ! is_admin() ) {
        wp_safe_redirect( admin_url() );
        exit();
    }
}

By Creating an Empty Theme

Create a blank theme, and only add index.php and style.css as its content. Now you can activate the theme, and everyone visiting the front-end will be getting a white page.

Leave a Comment