WordPress plugin intelligence profile

Only REST API

Redirects all front end, non-REST API requests to a single page.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 4.4
Current version1.0.0
WordPress coverageTested up to WordPress 4.4
Minimum stackWP 4.0 · PHP —
Directory statusactive
Last directory update7 Dec 201510y ago
Active installations20Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Only REST API version 1.0.0 as active, updated 10y ago and tested up to WordPress 4.4.

Overview

About this plugin

Got a WordPress install that serves only as the data layer and/or admin UI of your web application?

This plugin will effectively turn off all default front end output, redirect all front end urls to the main site url, and optionally display a message of your choice. The message can be a simple plain text message or you can use the included filters to completely control the HTML output.

All activity in the wp-admin and all requests for assets like images, scripts, files, etc. will be unaffected by this plugin. Only requests that go through the template_redirect action will be affected.

Message Output

Rather than contaminate the data structures you might be using for your application (like posts and pages) this plugin includes a settings page with a simple textarea box where you can save any basic message you want to show. The message content is stored in the options table, and the textarea supports all the same HTML that you can use in post content.

You can use the only_rest_api_page_content filter to include any custom HTML output you want inside the <body> tags, or you can use the only_rest_api_page_html filter to completely replace all HTML output of the message page, including the <html> and <head> tags.

There is also an only_rest_api_page_css filter that allows you to override the 5 lines of CSS this plugin includes to center the message on the page.

If you want a hook added or have a feature request let me know. Pull requests are welcome on Github.

Filter Examples

Use custom HTML inside the <body> tags:

add_filter( 'only_rest_api_page_content', 'xxx_page_content' ); function xxx_page_content( $content ) {

$content = '<div class="custom-output">Sorry, I Only Speak REST. </div>';

return $content; }

Add custom CSS to the default output:

add_filter( 'only_rest_api_page_css', 'xxx_page_css' ); function xxx_page_css( $css ) {

page-content { color: red; font-size: 72px; }';

return $css; }

Replace the entire HTML output for the page:

add_filter( 'only_rest_api_page_html', 'xxx_page_html' ); function xxx_page_html( $html ) {

ob_start();

css"> <script type="text/javascript"> // Do neat stuff... </script> </head> <body> <div class="page-content"> Ain't nobody got time for non-REST API requests. php

$html = ob_get_clean();

return $html; }

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • api
  • json
  • only
  • rest
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 4.4

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 4.4.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to4.4
Minimum requirementsWordPress 4.0 · PHP not listed
Update activity7 Dec 201510y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.