Skip to content

Instantly share code, notes, and snippets.

@rachelbaker
Created January 18, 2017 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachelbaker/d7fd4b856682e214d231ab473d1200a9 to your computer and use it in GitHub Desktop.
Save rachelbaker/d7fd4b856682e214d231ab473d1200a9 to your computer and use it in GitHub Desktop.
<?php
function create_custom_comments_rest_routes() {
// Custom Comments.
$controller = new WP_REST_Custom_Comments_Controller();
$controller->register_routes();
}
add_action( 'rest_api_init', 'create_custom_comments_rest_routes' );
class WP_REST_Custom_Comments_Controller extends WP_REST_Comments_Controller {
public function __construct() {
$this->namespace = 'cookie/v1';
$this->rest_base = 'comments';
$this->meta = new WP_REST_Comment_Meta_Fields();
}
public function update_item_permissions_check( $request ) {
// add custom logic here...
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment