Only REST API

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 custom CSS to the default output:

Replace the entire HTML output for the page:

0

评论0

 
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
显示验证码
没有账号?注册  忘记密码?

社交账号快速登录