You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: using-the-rest-api/frequently-asked-questions.md
+23-19Lines changed: 23 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,33 +8,37 @@ This page provides solutions to some common questions and problems that may aris
8
8
You should not disable the REST API, because doing so would break future WordPress Admin functionality that will depend on the API being active. However, you may use a filter to require that API consumers be authenticated, which effectively prevents anonymous external access. See below for more information.
9
9
10
10
11
-
## Require Authentication for All Reque​sts
11
+
## Require Authentication for All Requests
12
12
13
13
You can require authentication for all REST API requests by adding an `is_user_logged_in` check to the [`rest_authentication_errors`](https://developer.wordpress.org/reference/hooks/rest_authentication_errors/) filter.
14
14
15
-
Note: The incoming callback parameter can be either null, WP_Error or a boolean. The type of the parameter indicates the state of authentication:
15
+
Note: The incoming callback parameter can be either `null`, a `WP_Error`, or a boolean. The type of the parameter indicates the state of authentication:
16
16
17
-
* null: indicates another authentication method should check instead (implies no authentication was performed before)
18
-
* boolean: indicates a previous authentication method check was performed. Boolean true would indicate successfully and the user is authenticated. Boolean false not.
19
-
* WP_Error: Some kind of error was encountered.
17
+
*`null`: no authentication check has yet been performed, and the hook callback may apply custom authentication logic.
18
+
* boolean: indicates a previous authentication method check was performed. Boolean `true` indicates the request was successfully authenticated, and boolean `false` indicates authentication failed.
0 commit comments