How to allow tags in the excerpt?
-
I have been trying to allow the links from post to be shown on the excerpt as normal, clickable etc. But the tags seems to be stripping out, so i tried this
function customx_trim_excerpt($text = '') { if ( '' == $text ) { $text = get_the_content(''); $text = strip_shortcodes( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $excerpt_length = apply_filters('excerpt_length', 55); $excerpt_more = apply_filters('excerpt_more', ' ' . '[…]'); $text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); $allowed_tags = '<p><a><em><strong><img>'; } return $text; }but it seems as though I am doing something wrong with this function
The topic ‘How to allow tags in the excerpt?’ is closed to new replies.