How to Add Post Count to Category & Tag Meta Title?

If you use Yoast SEO WordPress plugin, just add this code to your theme’s functions.php:

// Add Post Count to Category or Tag Meta Title by SEODOX

function seodox_add_post_count_category_tag_meta_title($title) {
if (is_category() || is_tag()) {
$term_id = get_queried_object_id();
$term = get_term($term_id);
$post_count = $term->count;

$title = $post_count . '+ ' . $title; // Customize this line
return $title;
add_filter('wpseo_title', 'seodox_add_post_count_category_tag_meta_title', 10, 1);
add_filter('wpseo_opengraph_title', 'seodox_add_post_count_category_tag_meta_title', 10, 1);

This code will add post count to category and tag titles, such as:

Example Default Meta Title:

<title>Best SEO Tools – SEODOX</title>

<meta property=’og:title’ content=’Best SEO Tools – SEODOX’ class=’yoast-seo-meta-tag’ />

Modified Meta Title with Post Count:

<title>50+ Best SEO Tools – SEODOX</title>

<meta property=’og:title’ content=’50+ Best SEO Tools – SEODOX’ class=’yoast-seo-meta-tag’ />

This implementation will update post count in category and tag meta titles, whenever you create a new post.