3

I got a requirement (CRM system) and it can be developed using WordPress back-end.

So I don't need front-end 100%.

Is there way to disable the front-end 100%?

  • you can make a blank theme with just a fiel "index.php" containing wp_redirect(admin_url("/")); – mmm Nov 14 '17 at 11:29
6

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.

  • You can also return a falsey value from the template_include hook. – Nathan Johnson Nov 14 '17 at 16:38
  • Shouldn't it read wp_safe_redirect( admin_url() ); ? – brianjohnhanna Nov 15 '17 at 16:03
  • @brianjohnhanna Thanks for the note. Corrected now. – Jack Johansson Nov 15 '17 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.