Skip to content

Instantly share code, notes, and snippets.

@mjangda
Last active December 14, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjangda/5057113 to your computer and use it in GitHub Desktop.
Save mjangda/5057113 to your computer and use it in GitHub Desktop.
Sanitize callback that treats data as HTML.
<?php
function x_custom_metadata_sanitize_as_html( $field_slug, $field, $object_type, $object_id, $value ) {
if ( is_array( $value ) )
$value = array_map( 'wp_filter_post_kses', $value );
else
$value = wp_filter_post_kses( $value );
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment