I created an additional description field for categories, but what I write in html is saved in MSQL without html, how can I add HTML support to this field?
For example, I write a statement like this:
<div class="class-name">It's very hot these days</div>
I am looking at phpmyadmin and the only saved is "It's very hot today". Since only the text part is saved, the table, image, title.. etc none appear when I add it. I can't even make it thick.
Codes;
/* Custom Field for Categories */
function dm_category_fields($term) {
if (current_filter() == 'category_edit_form_fields') {
$bottom_description = get_term_meta($term->term_id, 'bottom_description', true);
?>
<tr class="form-field">
<th valign="top" scope="row"><label for="term_fields[bottom_description]"><?php _e('Sayfa Sonu Açıklaması'); ?></label></th>
<td>
<textarea class="large-text" cols="50" rows="10" id="term_fields[bottom_description]" name="term_fields[bottom_description]"><?php echo esc_textarea($bottom_description); ?></textarea><br/>
<span class="description"><?php _e('Kategori içeriğinin sonuna bir şeyler eklemek için. Shortcode destekler.'); ?></span>
</td>
</tr>
<?php } elseif (current_filter() == 'category_add_form_fields') {
?>
<div class="form-field">
<label for="term_fields[bottom_description]"><?php _e('Sayfa Sonu Açıklaması'); ?></label>
<textarea cols="40" rows="10" id="term_fields[bottom_description]" name="term_fields[bottom_description]"></textarea>
<p class="description"><?php _e('Kategori içeriğinin sonuna bir şeyler eklemek için. Shortcode destekler.'); ?></p>
</div>
<?php
}
}
add_action('category_add_form_fields', 'dm_category_fields', 10, 2);
add_action('category_edit_form_fields', 'dm_category_fields', 10, 2);
function wcr_save_category_fields($term_id) {
if (!isset($_POST['term_fields'])) {
return;
}
foreach ($_POST['term_fields'] as $key => $value) {
update_term_meta($term_id, $key, sanitize_text_field($value));
}
}
add_action('edited_category', 'wcr_save_category_fields', 10, 2);
add_action('create_category', 'wcr_save_category_fields', 10, 2);