Try using the ‘attribute_escape’ filter to replace the escaped text with alternatively escaped text. You need some kind of escaping even if it’s not the default method.
The problem here is letting non-term names be escaped as normal, as all sorts of values pass through this filter. Add the callback for this from a more specific callback hooked to something like “pre_{$taxonomy}_{$field}” filter. Then have the callbacks remove themselves from the filter stack when done with remove_filter()
.
Thanks but sorry i don’t really understand.
Do you have a code example to prevent to remove tag when editing a taxonomy term name ?
thanks
Everything is possible in WordPress however it depends on how your titles are coded in your theme. I assume you’re referring to your archive titles for taxonomies like category and tag archive page titles and i assume you want to add a tag to your titles?
https://developer.wordpress.org/reference/functions/get_the_archive_title/
But not all themes use this method.
I mean even in backend when I save a category term with html , the html is removed.
You can’t do that. You need to use PHP code to filter the title to wrap it in a HTML tag depending on what your theme uses for your archives.
Try get_the_archive_title
Something like this in your child themes functions file using the correct conditional tag
add_filter( 'get_the_archive_title', function ( $title ) {
if ( is_category() ) {
$title = '<div class="your-class">' . single_cat_title( '', false ) . '</div>';
}
return $title;
});
It as it is not for all the titles the logical won’t work. I going to create a meta field title html.
You can use the filter with conditional tags or copy over a template file from your parent theme to your child theme. Try a archive.php or index.php file which you can then modify in your child theme folder. You can see the template hierarchy here https://developer.wordpress.org/themes/basics/template-hierarchy/#category
You still haven’t stated what theme you are using?