Created
April 7, 2023 18:11
-
-
Save anka/3f4c813f9397ddba208d1be40bb8b966 to your computer and use it in GitHub Desktop.
Wordpress plugin code to register a custom route
This file contains 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
add_action('rest_api_init', 'register_custom_route'); | |
function register_custom_route() { | |
register_rest_route('custom-api-route/v1', '/submit', array( | |
'methods' => 'POST', | |
'callback' => 'process_data_submission', | |
'permission_callback' => '__return_true', | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment