Skip to content

Instantly share code, notes, and snippets.

@laxmariappan
Last active July 29, 2022 20:55
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 laxmariappan/6e535961133370a86117833ed0a78afd to your computer and use it in GitHub Desktop.
Save laxmariappan/6e535961133370a86117833ed0a78afd to your computer and use it in GitHub Desktop.
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