Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active December 13, 2023 12:30
Show Gist options
  • Save Crocoblock/f8802e82a36689fdae6dcb104b28edff to your computer and use it in GitHub Desktop.
Save Crocoblock/f8802e82a36689fdae6dcb104b28edff to your computer and use it in GitHub Desktop.
Disable sanitize output from disallowed HTML tags in Dynamic Field, allow additional tags for wp_kses_post function (for Dynamic Link/Repeater)

Disables sanitize for Dynamic Fields in Elementor, which have class disable-sanitize

add_filter( 'jet-engine/listings/dynamic-field/sanitize-output', function( $result, $df ) {

	if ( false !== strpos( $df->get( '_css_classes' ), 'disable-sanitize' ) ) {
		$result = false;
	}
	
	return $result;
	
}, 0, 2 );
<?php
add_filter( 'wp_kses_allowed_html', function ( $tags, $context ) {
if ( 'post' === $context ) {
$tags['input'] = array(
'type' => true,
'id' => true,
);
}
return $tags;
},10,2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment