How to use the_excerpt in a filter hook?

use the filter get_the_excerpt. Look at line no. 250 here, they are using the_excerpt internally on the function get_the_excerpt(), and in this function on line no. 272, they’re applying the filter get_the_excerpt on the actual excerpt. Hence,

add_filter('get_the_excerpt', 'exc');

function exc($param) {

    return "Whew !".$param;
}

is the way to go if you want to filter excerpts!

Leave a Comment