If you look at the source code of get_the_archive_title()
, you will see that there is a filter supplied, called get_the_archive_title
, through which you can filter the output from the function.
You can use the following to change the output on a category page:
1 2 3 4 5 6 7 8 9 10 11 | add_filter( 'get_the_archive_title', function ( $title ) { if( is_category() ) { $title = single_cat_title( '', false ); } return $title; }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.