> For the complete documentation index, see [llms.txt](https://andrearufo.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andrearufo.gitbook.io/notes/wordpress/manovrare-il-titolo-di-archivio-per-wordpress.md).

# Manovrare il titolo di archivio per Wordpress

Wordpress tramite la funzione `the_archive_title()` permette di stampare facilmente il titolo di ogni pagina archivio: tassonomia, categoria, tag, ecc.

Il testo che stampa però è preceduto dal tipo di archivio e per rimuovere questo testo basta usare l'hook di seguito:

```php
add_filter( 'get_the_archive_title', function ($title) {
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    } elseif ( is_tag() ) {
        $title = single_tag_title( '', false );
    } elseif ( is_author() ) {
        $title = '<span class="vcard">' . get_the_author() . '</span>' ;
    } elseif ( is_post_type_archive() ) {
        $title = post_type_archive_title( '', false );
    }elseif ( is_tax() ){
        $title = single_term_title( '', false );
    }
    return $title;
});
```
