stripping tags from excerpt in Wordpress is not working stripping tags from excerpt in Wordpress is not working php php

stripping tags from excerpt in Wordpress is not working


What you need is get_the_excerpt():

<a href='<?php the_permalink() ?>' title='<?php echo strip_tags( get_the_excerpt() ); ?>'>

However, it probably won't strip out ellipses (…) since they're HTML entities, not tags.


It's because the_excerpt() outputs the excerpt right away. You want get_the_excerpt() which returns it as a string you can maninpute (http://codex.wordpress.org/Function_Reference/get_the_excerpt).

You can also use wp_filter_nohtml_kses() (http://codex.wordpress.org/Function_Reference/wp_filter_nohtml_kses)

Something like:

$title = wp_filter_nohtml_kses(get_the_excerpt());