After your edit it makes more sense. First, you should really read up on filters. They exist to modify the behaviour of functions. They are included in functions.php
.
So if you use the function the_archive_title
it contains a filter get_the_archive_title
to modify its output. It looks like you got your code snippet from that developer page, actually, but put it in the wrong place.