Skip to content

Commit 1a653ed

Browse files
author
Motifs Media
authored
changed "a executable" to "an executable" (#119)
1 parent a2c6469 commit 1a653ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: extending-the-rest-api/routes-and-endpoints.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ add_action( 'rest_api_init', 'prefix_register_example_routes' );
479479

480480
#### Sanitizing
481481

482-
In the above example, we do not need to use a `sanitize_callback`, because we are restricting input to only values in our enum. If we did not have strict validation and accepted any string as a parameter, we would definitely need to register a `sanitize_callback`. What if we wanted to update a content field and the user entered something like `alert('ZOMG Hacking you');`. The field value could potentially be a executable script. To strip out unwanted data or to transform data into a desired format we need to register a `sanitize_callback` for our arguments. Here is an example of how to use WordPress's `sanitize_text_field()` for a sanitize callback:
482+
In the above example, we do not need to use a `sanitize_callback`, because we are restricting input to only values in our enum. If we did not have strict validation and accepted any string as a parameter, we would definitely need to register a `sanitize_callback`. What if we wanted to update a content field and the user entered something like `alert('ZOMG Hacking you');`. The field value could potentially be an executable script. To strip out unwanted data or to transform data into a desired format we need to register a `sanitize_callback` for our arguments. Here is an example of how to use WordPress's `sanitize_text_field()` for a sanitize callback:
483483

484484
```php
485485
/**

0 commit comments

Comments
 (0)