Function Reference/sanitize post field
Description
Sanitize a post field based on the context of where the field is being used.
Usage
Parameters
- $field
- (string) (required) The post object field name
- Default: None
- $value
- (mixed) (required) The post object value
- Default: None
- $post_id
- (integer) (required) The Post ID
- Default: None
- $context
- (string) (required) How to sanitize post fields. Can be: 'raw', 'edit', 'db', 'display', 'attribute' or 'js'
- Default: None
Return Values
- mixed
- The sanitized value
Examples
Notes
Change Log
Since: 2.3.0
Source File
sanitize_post_field() is located in wp-includes/post.php.
Related