Merge pull request #1362 from ultimatemember/fix/content_block_new_line

Content block field new line
This commit is contained in:
Mykyta Synelnikov
2023-11-21 14:06:58 +02:00
committed by GitHub
@@ -655,6 +655,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
}
} elseif ( false !== strpos( $key, 'um_editor' ) ) {
if ( 'block' === $array['post']['_type'] ) {
// the nl2br() function does not work as expected, there is an extra empty line left
// use str_replace for correct work
$val = str_replace( "\r\n\r\n", '<br>', $val );
$save[ $field_id ]['content'] = wp_kses_post( $val );
} else {
$save[ $field_id ]['content'] = sanitize_textarea_field( $val );