Skip to content

Instantly share code, notes, and snippets.

@laxmariappan
Last active Jul 29, 2022
Embed
What would you like to do?
Custom route to check email notification status.
<?php
/**
* Custom route to check email notification status.
*
* @return void
* @since 1.0
* @author Lax Mariappan <lax@webdevstudios.com>
*/
function gnotice_rest_init() {
$namespace = 'api-gnotice/v1';
$route = 'check-email-response';
register_rest_route(
$namespace,
$route,
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => 'get_email_notification',
'permission_callback' => 'permission_callback' => function() { return current_user_can('edit_posts'); },
)
);
}
add_action( 'rest_api_init', 'gnotice_rest_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment