There are different filters for the more-link, depending on whether you want it at the end of the_content
or the_excerpt
. Ultimately both work the same though. Selecting the last three words is a matter of PHP-skills. Like this:
add_filter ('the_content_more_link','wpse339250_three_words',10,2);
function wpse339250_three_words ($more_link, $more_link_text) {
$excerpt = get_the_excerpt();
// split the excerpt in array of words
$words = explode(' ', $excerpt);
// starting at the third position from the end take three words
$three_words = array_slice ($words, -3, 3, true);
// replace the standard text in the link with the custom one
return str_replace ($more_link_text, $three_words, $more_link);
}
You may want to make a slightly more complex function to account for edge cases, such as the excerpt not being set or containing less than three words.
A different approach would be to kill the standard more-link altogether and use the get_the_excerpt
filter to wrap the last three words in the permalink. You’d need the same PHP-trick to find the last three words.