WP-API / OAuth2

Connect applications to your WordPress site without ever giving away your password.
GNU General Public License v2.0
171 stars 41 forks source link

Add permission_callback to Route Registration #69

Open amberjones opened 2 years ago

amberjones commented 2 years ago

As of WordPress 5.5, if a permission_callback is not provided, the REST API will issue a _doing_it_wrong notice.

This is a function that checks if the user can perform the action (reading, updating, etc) before the real callback is called. This allows the API to tell the client what actions they can perform on a given URL without needing to attempt the request first.

For REST API routes that are intended to be public, use __return_true as the permission callback

There are two places to add the permissions callback: The /access_token route. The /authorize route.