How to integrate wordpress in another website

In another website constructed more than a decade ago, I integrated WordPress pages just as iframe .This was quite common at that time but not very elegant as all the formatting had to be adjusted to the parent site for a coherent view. When revising the website last week I have chosen a radical different approach by completely silencing the WP output using a plugin

<?php
/** Plugin Name: shutup **/
add_action( 'template_redirect', function() {
  wp_die( __( 'disabled' ) ); 
});
?>

WP pages and posts are retrieved in the main website using the WP API only

$api_url = 'https://www.DOMAIN.de/BLOGNAME/wp-json/wp/v2/pages/xxxx';
$response = file_get_contents($api_url);
$posts = json_decode($response);
echo $posts->content->rendered;

CC-BY-NC