Reply To: HTML in info box/excerpt

Home Forums MapPress Support HTML in info box/excerpt Reply To: HTML in info box/excerpt

#18749
Chris
Keymaster

Hi,

I don’t think it’s changed, but MapPress calls the function wp_trim_words() to limit excerpts to 55 characters.  That function also strips out any HTML tags and characters.

The wp_trim_words() function is also called in normal theme functions like the_excerpt().  It’s an involved process, this article has an explanation:

https://www.satollo.net/how-the_excerpt-function-works-in-wordpress

Anyway, if you want to force tags through, there’s a filter that allows you to determine what wp_trim_words() should return.  The filter’s last argument is the orginal text, so if you add the following to your theme’s functions.php file, it should return it unaltered.

Note that this will affect all excerpts, including elsewhere in the blog.

function mytrimwords($text, $num_words, $more, $original_text) {
return $original_text;
}
add_filter('wp_trim_words', 'mytrimwords', 10,4);