Add Custom Meta to Archive Title

This snippet adds custom meta information to the archive title, providing more context for users browsing archives.

PHP

function add_meta_to_archive_title($title) {
    if (is_category()) {
        $title .= ' - Category Archive';
    } elseif (is_tag()) {
        $title .= ' - Tag Archive';
    } elseif (is_author()) {
        $title .= ' - Author Archive';
    }
    return $title;
}
add_filter('get_the_archive_title', 'add_meta_to_archive_title');

Snippet Feedback

Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.
SHARED BY

Tags

Language

Did it work?

Save Snippet

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.