I did some investigation.
I am using the Text Control plugin which protects content, excerpts and comments (if I want) from the WP filter – wp_kses_post.
I think what I need to do is replace the sanitize code with that of the code text areas:
return htmlspecialchars_decode( stripslashes( $this->value ) );
Is there any way to do this in an outside function in my custom metabox plugin (in which CMB2 is enclosed) so I will be able to control where this happens?
Thanks
Mike
/**
* Sanitize textareas and wysiwyg fields
* @since 1.0.1
* @return string Sanitized data
*/
public function textarea() {
return is_array( $this->value ) ? array_map( 'wp_kses_post', $this->value ) : wp_kses_post( $this->value );
}
/**
* Sanitize code textareas
* @since 1.0.2
* @return string Sanitized data
*/
public function textarea_code( $repeat = false ) {
if ( $repeat_value = $this->_check_repeat( __FUNCTION__, $repeat ) ) {
return $repeat_value;
}
return htmlspecialchars_decode( stripslashes( $this->value ) );
}