sanitize_post_field


sanitize_post_field ( $field, $value, $post_id, $context = 'display' )

Parameters:
  • (string) $field The Post Object field name.
  • (mixed) $value The Post Object value.
  • (int) $post_id Post ID.
  • (string) $context Optional. How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. Default 'display'.
Returns:
  • (mixed) Sanitized value.
Defined at:
Change Log:
  • 4: .

Description

Sanitize post field based on context.

Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' when calling filters.

Related Functions

sanitize_text_field, sanitize_term_field, sanitize_user_field, sanitize_post, _sanitize_text_fields

Top Google Results

User discussions

wpseek mobile