Will McLean is a designer and artist working in the Central Coast of NSW where he lives with his wife and 2 children.

Will is a meticulous developer and favours simplicity and clarity within his code. He can’t stand writing things twice so searches for any way to automate. His experiments can be found in the Exercises section of this site.

Will designs within systems. No project is too small for a design system. He favours the unusual, if not, how can he progress? You can read about his work in the Case Studies section of this site.

Updated: May 2, 2018

This is a Knowledge Base post.

Disable the archive label in the default WordPress title function

When you are showing the title of an achive page in WordPress (ie. a taxonomy term, a post type achive etc.) You can’t use the_title(); as this just grabs the title of the first post in your page. You must use get_the_archive_title();. However this prepends the title with various forms of “Archive: “. So your title ends up being something like “Archive: Custom Post Types”. For me personally that is great, but I am a brutalist. I like to embrace the system with which we build our websites and display things like this with no alteration… But try getting a job with that attitude!! So below is how to remove them. Add this to your functions.php file. Source.


function remove_label_from_archive_title( $title ) {
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    } elseif ( is_tag() ) {
        $title = single_tag_title( '', false );
    } elseif ( is_author() ) {
        $title = '' . get_the_author() . '';
    } elseif ( is_post_type_archive() ) {
        $title = post_type_archive_title( '', false );
    } elseif ( is_tax() ) {
        $title = single_term_title( '', false );
    }

    return $title;
}

add_filter( 'get_the_archive_title', 'remove_label_from_archive_title' );