How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]

I’ve always found that the best way to learn about how WP works and how you can modify it is to search the Codex at https://codex.wordpress.org/

For example, first I find the Codex page for the_archive_title() and there I see that it’s a wrapper for get_the_archive_title() and there, looking at the source code, I see that at the end of the function the result is returned through a filter also called get_the_archive_title.

So, now I know I can affect the output using that filter, I can write a little function to add to my theme’s functions.php file to hook into that:

function change_my_title( $title ){
    if ( $title == "Archives: Projects" ) $title = "Viewing All Offices";
    return $title;
}
add_filter( "get_the_archive_title", "change_my_title" );

Hope that helps

tech