Example of enabling authorization in WordPress
For more information about the requirements for comments and authorization resources, see the Adding authorization and Adding commenting sections.
The steps for adding login functionality are described below.
Step 1. Create a file with the HTML headers for the login form
- In your WordPress site repository, create the /api/turbo/headers.php file.
- Copy the content of api/turbo/headers.php to the created headers.php file.
Learn more about the headers.php file in tutorial video (6: 21).
- Copy the content of wp-content/themes/twentynineteen/functions.php to the end of the functions.php file that exists in your project.
Learn more about the functions.php file in tutorial video (7:47).
Step 2. Create a resource that checks authorization
- Create the /api/turbo/auth.php file in your site repository.
- Copy the api/turbo/auth.php file content to the auth.php file you created.
Learn more about the functions.php file in tutorial video (9:40).
Step 3. Create a resource that performs logout
- Create the /api/turbo/logout.php file in your site repository.
- Copy the api/turbo/logout.php file content to the logout.php file you created.
Learn more about the logout.php file in tutorial video (11:18).
Step 4. Connect and check authorization
- In Yandex.Webmaster, open thepage.
- Specify links to resources:
- URL of the page with the login form, for example,
https://my-domain.ru/wp-logn.php
. - The URL to verify the authorization, such as
https://my-domain.ru/api/auth
. - The URL for logging out, such as
https://my-domain.ru/api/logout
.
- Save your changes.
- See how authentication works on the sample Turbo page.