WPDev.one
Core Function
View Source on Trac ↗

sanitize_post()

sanitize_post( mixed $post, mixed $context = 'display' )

Sanitizes every post field.

Parameters 2 required

Name / Type Description
(object

| WP_Post | array) $post The post object or array

Required
string

$context Optional. How to sanitize post fields. Accepts 'raw', 'edit', 'db', 'display', 'attribute', or 'js'. Default 'display'.

Required

Return Value

((object)
(object | WP_Post | array) The now sanitized post object or array (will be the same type as `$post`).

Function Information

Since Version
2.3.0
Source File
wp-includes/post.php
Advertisement