I want to change the title of my archive page from "category" to "department" to get something like this: Department: Marketing. Where "department" is the archive page title and "Marketing" is the actual name. This is the code that I used:
add_filter( 'get_the_archive_title', function ( $title ) {
if( is_category() ) {
$title = 'department';
}
return $title;
});
But It hides the page name. When I use this code, I get only "Department" as a title and when I delete it, I get "category: department".
How to fix it?