Title says pretty much all of it. I need a filter that I can use to change excerpt content for those posts that have no excerpt set.
Now, I've tried both the_excerpt
and get_the_excerpt
, they both pass one parameter, and in both cases said parameter is empty string.
That said, I will need to hook onto a filter that has access to the auto-generated except, and lets me change it.
Perhaps something like this (untested)?
function my_filter_the_excerpt( $excerpt ) {
global $post;
if( empty( $post->post_excerpt ) ) {
// Excerpt is auto-generated
$excerpt = 'Something else...';
}
return $excerpt;
}
add_filter( 'get_the_excerpt', 'my_filter_the_excerpt' );