how to change the title of tag page?

what is the correct function or hook to change the title of tag page ? I want to insert something at the beginning the tag title page.

Topic title rewrite-tag Wordpress

Category Web


You can use the get_the_archive_title filter, such as:

add_filter('get_the_archive_title', function($title) {
  if(is_tag()) {
    /* logic to set $title to what you want */
  }
  return $title;
});

Take a look at get_the_archive_title() reference for more information on how to use this filter.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.