Created
January 18, 2017 02:53
-
-
Save rachelbaker/d7fd4b856682e214d231ab473d1200a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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