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
This commit is contained in:
parent
0b8101849e
commit
8ef82f4792
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user