Skip to content

Commit 54739da

Browse files
authored
Update adding-custom-endpoints.md to note permalink structure (WP-API#189)
1 parent 4b39649 commit 54739da

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extending-the-rest-api/adding-custom-endpoints.md

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Right now, we're only registering the one endpoint for the route. The term "rout
4949

5050
For example, if your site domain is `example.com` and you've kept the API path of `wp-json`, then the full URL would be `http://example.com/wp-json/myplugin/v1/author/(?P\d+)`.
5151

52+
[alert]
53+
On sites without pretty permalinks, the route is instead added to the URL as the `rest_route` parameter. For the above example, the full URL would then be <code>http://example.com/?rest_route=/myplugin/v1/author/(?P\d+)</code>
54+
[/alert]
55+
5256
Each route can have any number of endpoints, and for each endpoint, you can define the HTTP methods allowed, a callback function for responding to the request and a permissions callback for creating custom permissions. In addition you can define allowed fields in the request and for each field specify a default value, a sanitization callback, a validation callback, and whether the field is required.
5357

5458

0 commit comments

Comments
 (0)