I want to create a REST endpoint on my WordPress site. This is to be consumed by a computer so I don’t want any HTML in it at all.
To create a blank endpoint is only necessary to create a blank template and then create a new page that uses that template. Anything you put in that page will be rendered without any boilerplate.
<?php /** * Template Name: Blank Page * https://blog.jamesbayley.com/2015/06/03/how-to-render-a-blank-wordpress-page */ ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; ?> <?php endif; ?>