To disable WP frontend and WP REST API output, create an empty theme, i.e. ‘My Empty Theme’ in /wp-content/themes/myemptytheme/, that contains 3 files:
- style.css
- index.php
- functions.php
style.css may contain the theme name only:
/*
Theme Name: My Empty Theme
*/
index.php – leave it empty
functions.php – include the following code to disable REST API output:
<?php
add_filter( 'rest_authentication_errors', 'no_rest_api' );
function no_rest_api( $result ) {
return new WP_Error( 'no_rest_api', 'Rest API disabled', array( 'status' => rest_authorization_required_code()));
}
?>
When you query a REST API endpoint, the response will be:
{
"code": "no_rest_api",
"message": "Rest API disabled",
"data": {
"status": 403
}
}
Remember to switch to the new theme after creating the theme files.
Related Posts:
- How do I represent ‘chunks’ of content within WordPress?
- Blog posts on one subdomain, pages on another
- How can I import users into WordPress?
- Stress testing WordPress
- Can I use wordpress for a non-blog site?
- Can I / Should I use WordPress as a CMS for my Flash application
- Using wordpress for a four-page website may be an overkill?
- Searching Only Blog Posts From a WordPress Site’s Main Posts Page?
- WordPress product catalog site [closed]
- What are the advantages of WordPress over other systems?
- Putting main WordPress blog under a different folder name
- Is a complex site possible with WordPress?
- Convert link in WordPress 3.2.1
- WordPress for a business catalog site
- Why are wordpress posts not hierarchical?
- Updating my wordpress CMS to 4.7 gives me a blank HTML area during the upgrade process
- Content management for static pages
- WordPress in Drupal
- Why does blog page not reveal it’s template?
- Is wordpress truly capable of anything other than blogging? [closed]
- Is wordpress a library with a default GUI?
- Editing Code for CMS *** Fixed – my own stupidity – I appologise and thank everyone for their help [closed]
- Show a different link based on IP
- Can I manage content of my custom site using wordpress?
- Get Drupal user into WordPress
- How do I add open graph tags? [closed]
- Can’t access Dashboard after WordPress 3.3 Update?
- Heterogeneous content on a page
- Multiple editable content on page
- Set a WordPress website’s language without affecting the back-end
- Can WordPress used as a CMS? [closed]
- “No X11 DISPLAY variable” – what does it mean?
- Tips for using WordPress as a CMS? [closed]
- Implementing a CrunchBase.com Clone using WordPress?
- Style custom columns in admin panels (especially to adjust column cell widths)
- Is there anything that Joomla or Drupal can do that can’t be done in WordPress? [closed]
- Edit “thank you for creating with WordPress” in version 3.3.1
- How to prevent a post from being deleted?
- Is there a way I can write a series in WordPress?
- Any way to make posts inherit properties/taxonomies through a single assigned taxonomy
- WordPress as a CMS Membership website
- Different number of posts in each category
- Strategy for handling hierarchical pages with empty parent content
- How to Use WordPress as Static CMS Without Blog Posts
- How can I make post fields required in WordPress?
- Creating my own Admin Forms in a WordPress CMS?
- Can WordPress realistically handle a site with 500 ‘pages’?
- How can I use WordPress as a job board ? (but free)
- Using WordPress as piecemeal in existing site?
- Pods cms and “advanced custom fields” plugin
- Multiple level category drop-down
- Does wordpress have something like content-type?
- Hide update messages from non-admin users?
- how do I group content in magazine-style ‘issues’?
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- Sub-directory blog on a sub-domain WordPress network site
- Guidance with The Loop for CMS
- Minor css-change based on topmenu – how?
- WordPress as Backend, Laravel Front End: How to connect Routes?
- Creating a searchable A-Z listing of hundreds of companies/services
- Downsides to not using built-in “Posts” post type?
- How do I create a custom post type for a training CMS in WordPress?
- WordPress CMS – hide content from public while in editing stages
- What is a good way to present templated content in WordPress?
- WordPress plugin for authoring technical documentation? [closed]
- Migrating from other CMS to WP – losing SEO juice?
- Search form with Category and Sub Category
- CMS: Making complex pages editable by the end user
- How could I create a ‘private comments’ section on a custom post type?
- Can part of my WordPress website be headless?
- Strange problems when I try to insert HTML\XML code snippet in my posts
- Migrating database / content of non-CMS site to WordPress
- Headless WordPress – Issue with plugin path
- WordPress as a data intensive web app
- raw code vs wordpress
- WordPress shows registration link for non logged users
- New to CMS – WP functionality. overkill or just right?
- Allow users to post to a certain category
- Using the “Latest posts” feature on a different site
- Only expose routes with prefix /wp-json on WordPress using Apache
- WordPress vs. Custom PHP [closed]
- Remove permalink settings in post for users
- Is there a plugin or simple way to add a multiple images metabox to a post?
- Hide comments column in WordPress backend
- We have a static Hugo website and we want to migrate it to WordPress
- How do I get the intended post type of a revision post?
- Can I use a plugin for a singular page on my website?
- How to display only posts assigned to a particular, isolated, subcategory
- How to leave a line between paragraphs when writing text in the visual or text editor
- Pull the content out of a page
- How do I get blog posts to appear within CMS?
- How to set up an entity (post-type?) with many dependent entities (more post-types?)
- WordPress CMS Inquiry
- Anonymous Postings
- Custom post type content using custom fields without template
- Advanced templating / WordPress as a CMS questions
- How to import a Typo3 database to a wordpress site?
- Multi-page posts: A subdirectory for each post?
- Associating two custom post types
- Should I use “Categories ” or “Pages” for a WordPress Static Site (A non blog site)?