Opened 8 years ago
Closed 6 years ago
#45799 closed enhancement (invalid)
Add an optional default parameter for WP_REST_Request::get_param method
| Reported by: | ediamin | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | REST API | Version: | |
| Severity: | normal | Keywords: | has-patch close |
| Cc: | Focuses: | rest-api |
Description
This patch adds a default parameter for WP_REST_Request::get_param method, just like we have a default param for get_option function.
Attachments (1)
Change History (8)
#2
follow-up:
↓ 3
@
8 years ago
What is the use case for a default value that you wouldn't want to provide by using the JSON Schema default syntax which will automatically fill in a missing value with the default.
#3
in reply to: ↑ 2
@
8 years ago
The default property in JSON Schema is not a required property and anyone could skip it.
#4
@
8 years ago
Skip it in what sense? The server/request will apply the default automatically.
In what instances do you know the proper default value for a param, but not in the position to notate that default in the schema.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Proposed changes for WP_REST_Request::get_param method