Hello (please sorry about my bad English)
I need to insert images in the TAG description. Unfortunately, when I insert an image, Worpdress transforms the HTML code like this:
<img src=\"https://dev.mysite.com/wp-content/uploads/2023/04/my-image.jpg\" alt=\"my image\" width=\"750\" height=\"419\" />
I googled for a whole day for possible solutions and found various codes to add to the functions.php file
I used the code suggested by WooCoomerce here
https://woocommerce.com/document/allow-html-in-term-category-tag-descriptions/
I also tried this code
add_filter('wp_kses_allowed_html', function ( $allow ) {
if ( is_admin()) $allow['img'] = ['src' => true, 'alt'=> true, 'width'=> true, 'height'=> true,];
return $allow;
});
Or this:
remove_filter('pre_user_description', 'wp_filter_kses');
remove_filter('pre_term_description', 'wp_filter_kses');
remove_filter( 'pre_link_notes', 'wp_filter_kses' );
remove_filter( 'term_description', 'wp_kses_data' );
And this:
foreach (array('pre_term_name') as $filter) {
remove_filter($filter, 'sanitize_text_field');
remove_filter($filter, 'wp_filter_kses');
remove_filter( $filter, '_wp_specialchars', 30 );
}
But nothing works. I can add text formatting like BOLD or Italiac, but no images or url. Is there any way to add images to the TAG description? Maybe it’s possible to do it with the pro version of one of your themes?
Thanks in advance and sorry again for my bad English.