As you can see, the default excerpt length is still 150, but we’ve also applied
some filters to it. A filter allows you to write a function that modifies the
value of something — in this case, the excerpt’s length. The name (or tag) of
this filter is excerpt_length, and if no functions are attached to it, then its
value will remain 150. Let’s see how we can now use this to modify the
default value.
First, we have defined a function that does nothing but return a number. At
this point, nothing is using the function, so let’s tell WordPress that we want
to hook this into the excerpt_length filter.