From 8ef82f47926de55a0f5ca5d62f7e99b5d8f55cf3 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 12 Sep 2015 15:45:15 +0000 Subject: [PATCH] `sanitize_post()`: the default value for `$context` is 'display'. The documentation says the default for `sanitize_post_field()` is 'display', but there is no default for the arg. Make the argument: `$context = 'default'`. Props morganestes. Fixes #33117. git-svn-id: https://develop.svn.wordpress.org/trunk@34081 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/post-functions.php b/src/wp-includes/post-functions.php index 404d07cc6b..7c0786239a 100644 --- a/src/wp-includes/post-functions.php +++ b/src/wp-includes/post-functions.php @@ -1835,15 +1835,16 @@ function sanitize_post( $post, $context = 'display' ) { * are treated like 'display' when calling filters. * * @since 2.3.0 + * @since 4.4.0 Like `sanitize_post()`, `$context` defaults to 'display'. * * @param string $field The Post Object field name. * @param mixed $value The Post Object value. * @param int $post_id Post ID. - * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', - * 'db', 'display', 'attribute' and 'js'. + * @param string $context Optional. How to sanitize post fields. Looks for 'raw', 'edit', + * 'db', 'display', 'attribute' and 'js'. Default 'display'. * @return mixed Sanitized value. */ -function sanitize_post_field($field, $value, $post_id, $context) { +function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) { $int_fields = array('ID', 'post_parent', 'menu_order'); if ( in_array($field, $int_fields) ) $value = (int) $value;