I am new to WordPress and I'm trying to make a POST request to login a user. I want to be able to send "username" and "password" as params while making this call. How can I do so. This my code so far

        register_rest_route(
            'custom-plugin', '/login/(?P<username>\d/(?P<password>\d)',  
              array(
                'methods'  => 'POST',
                 'callback' => 'login_user',
         ));

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.