WordPress as API

The WordPress app can be used to provide endpoints for the front end app (based on any popular view library) to consume.

In that case, the theme should consist of files that are the required minimum for admin functionality—functions.php, index.php, screenshot.png (optional), and style.css.

Usually, functions.php contains redirection so that users can never access the 'php' WordPress front

add_action( 'template_redirect', 'inf_theme_redirect' );
if ( ! function_exists( 'inf_theme_redirect' ) ) {
   * Check if you are on any other page then admin and redirect accordingly.
   * @return void
  function inf_theme_redirect() {
    if ( ! is_user_logged_in() ) {
    } elseif ( ! is_admin() ) {
      wp_redirect( site_url( 'wp-admin' ) );

The endpoints for the front end app should be created using either REST API or Decoupled JSON Content plugin.

This functionality should be defined in a plugin.