Pledge Form: Allow HTML within descriptions.

Fixes #63
This commit is contained in:
Ian Dunn 2019-10-30 13:09:17 -07:00
parent 782a40bcda
commit e61ce467cb
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB
3 changed files with 19 additions and 4 deletions

View file

@ -36,9 +36,9 @@ function get_pledge_meta_config( $context = 'all' ) {
$user_input = array(
'org-description' => array(
'single' => true,
'sanitize_callback' => 'sanitize_text_field',
'sanitize_callback' => __NAMESPACE__ . '\sanitize_description',
'show_in_rest' => true,
'php_filter' => FILTER_SANITIZE_STRING,
'php_filter' => FILTER_UNSAFE_RAW,
),
'org-name' => array(
'single' => true,
@ -93,6 +93,21 @@ function get_pledge_meta_config( $context = 'all' ) {
return $return;
}
/**
* Sanitize description fields.
*
* @param string $insecure
*
* @return string
*/
function sanitize_description( $insecure ) {
$secure = wp_kses_data( $insecure );
$secure = wpautop( $secure );
$secure = wp_unslash( wp_rel_nofollow( $secure ) );
return $secure;
}
/**
* Register post meta keys for the custom post type.
*