Created
January 30, 2024 12:38
-
-
Save PluginRepublicSupport/f1b5d3026356a6c5a27c10425a6095bd to your computer and use it in GitHub Desktop.
Allow HTML content in field description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow HTML content in field description | |
*/ | |
function prefix_html_in_description( $description, $item, $additional_info='' ) { | |
$field_description = ! empty( $item['field_description'] ) ? $item['field_description'] : ''; | |
// Allow HTML content in the field description | |
$allowed_tags = wp_kses_allowed_html( 'post' ); | |
$field_description = wp_kses( $field_description, $allowed_tags ); | |
$description = sprintf( | |
'<div class="pewc-description">%s%s</div>', | |
$field_description, | |
$additional_info | |
); | |
return $description; | |
} | |
add_filter( 'pewc_filter_field_description', 'prefix_html_in_description', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment