$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>How to Completely Remove Archive Title a.k.a the_archive_title?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to Completely Remove Archive Title a.k.a the_archive_title?

matteradmin8PV0评论

I want to remove it COMPLETELY. Not only the label "Archive: " but EVERYTHING. It should not appear. I've been looking for the solution for hours to no avail.

Please help. Thank you!

I want to remove it COMPLETELY. Not only the label "Archive: " but EVERYTHING. It should not appear. I've been looking for the solution for hours to no avail.

Please help. Thank you!

Share Improve this question asked Nov 12, 2018 at 11:29 Syamsul AlamSyamsul Alam 11 silver badge6 bronze badges 4
  • So the page should render as <title></title>? – kero Commented Nov 12, 2018 at 11:32
  • You need to remove it from the template, that's it. – Jacob Peattie Commented Nov 12, 2018 at 11:40
  • @kero if i remove it, are my title tag gonna be empty? I just want to remove the <h1>Archive: Bla3</h1> not removing the title tag, is it possible? – Syamsul Alam Commented Nov 13, 2018 at 3:17
  • @JacobPeattie can you please elaborate in answer, i'm not familiar with removing it from template.. thank you mate. :D – Syamsul Alam Commented Nov 13, 2018 at 3:30
Add a comment  | 

2 Answers 2

Reset to default 0

You can add the following function in the functions.php of your child theme.

add_filter('get_the_archive_title', 'my_get_the_archive_title' );
function my_get_the_archive_title( $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>' ;
    }

    return $title;
}

Basically I'm adding this code in my theme's / child theme's function.php

add_filter('get_the_archive_title', 'my_get_the_archive_title' );
function my_get_the_archive_title( $title ) {
    return '';
};

And voilà it's gone, completely, forever!! Just the way I want it!

Post a comment

comment list (0)

  1. No comments so far