Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Jhon-mantila/pluging-wordpress/llms.txt

Use this file to discover all available pages before exploring further.

The category_post_count shortcode returns the number of published posts in a WordPress category as a plain integer — no surrounding markup, no labels. Because it outputs only a number, it is designed to be embedded directly inside sentences, headings, or alongside other content. Internally, the shortcode calls get_term_by('slug', ...) to locate the category term and reads the $term->count property, which WordPress keeps up to date automatically. If the category attribute is omitted or the given slug does not match any existing category, the shortcode outputs 0.

Basic Usage

[category_post_count category="anime"]

Parameters

category
string
required
The slug of the WordPress category whose post count you want to display. The slug is the URL-friendly identifier WordPress assigns to each category (e.g., anime, gaming, noticias). Returns 0 if the attribute is not provided or if no category with the given slug exists.

Usage Examples in Context

Embed the count naturally inside a sentence:
Hay [category_post_count category="anime"] artículos de anime en este sitio.
Display counts for multiple categories side by side:
Anime: [category_post_count category="anime"] | Gaming: [category_post_count category="gaming"]
Use inside a heading or callout block:
¡Ya tenemos [category_post_count category="reseñas"] reseñas publicadas!

Finding a Category Slug

The category slug is the URL-friendly identifier shown in the category archive URL. For example, if a category archive lives at https://mysite.com/category/anime/, its slug is anime. You can also find and edit slugs in your WordPress dashboard under Posts → Categories — the slug appears in the dedicated Slug column of the categories table.

Build docs developers (and LLMs) love