WordPress as API

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

In this 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 the users cannot access the 'php' WordPress front.

add_action( 'template_redirect', 'inf_theme_redirect' );
if ( ! function_exists( 'inf_theme_redirect' ) ) {
   * Check whether the user is logged in or is trying to access the front-end page.
   * In either case, the user should be redirected to the WordPress admin page.
   * @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 the Decoupled JSON Content plugin.

This functionality should be defined in the plugin.