Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Created May 22, 2024 08:00
Show Gist options
  • Save Crocoblock/7be0dbdb31b965c5036c2ec0a20b70c6 to your computer and use it in GitHub Desktop.
Save Crocoblock/7be0dbdb31b965c5036c2ec0a20b70c6 to your computer and use it in GitHub Desktop.
JetEngine unslash values before storing a CCT item
<?php
add_filter( 'jet-engine/custom-content-types/update-item/sanitize-field-value', function( $value, $field_name, $field ) {
if ( ! is_string( $value ) ) {
return $value;
}
if ( empty( $field['type'] ) || ! in_array( $field['type'], array( 'text', 'textarea' ) ) ) {
return $value;
}
return wp_unslash( $value );
}, 0, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment