Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Activate REST API for WordPress.
Plugin Name: Activate REST API
Plugin URI:
Description: Enable comments via rest api without login. Give front-end raw HTML via REST API.
Version: 0.2
Author: Cooler
Author URI:
License: Unlicense
License URI:
add_filter( 'rest_allow_anonymous_comments', '__return_true' );
add_action( 'rest_api_init', function () {
'get_callback' => 'compasshb_do_shortcodes',
'update_callback' => null,
'schema' => null,
function compasshb_do_shortcodes( $object, $field_name, $request ) {
WPBMap::addAllMappedShortcodes(); // This does all the work
global $post;
$post = get_post ($object['id']);
$output['rendered'] = apply_filters( 'the_content', $post->post_content );
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.