User Content Column
Yoko Core replaces the Posts column on Users → All Users with a Content column that shows how much content each user authored, broken out by post type.
WordPress core's own column counts published posts of type post only, so on any site
whose content lives in custom post types it reads 0 for everybody. The Content column
counts every post type on the site and links each line to that author's list.
What a cell looks like
Collapsed — this is what you see on page load:
▸ 14,296 items
Expanded, after clicking the caret:
▾ 14,296 items
Posts: 10,830
Events: 175
People: 1,511
Webinars: 553
- The always-visible summary is the total across all counted post types.
- Expanding reveals one line per post type, using that post type's own plural label,
each linking to
edit.php?post_type=<type>&author=<user>. - Post types the user has nothing in are omitted, so the breakdown stays short.
- A user with nothing authored shows
No contentwith no caret — there is nothing to reveal.
The accordion is a native <details> / <summary> pair, so the caret, the click and
keyboard handling, and the expanded/collapsed state announced to screen readers all come
from the browser. The column ships no JavaScript, and the summary carries a
screen-reader-only "Show the breakdown by post type" hint. Rows start collapsed on every
page load; the open/closed state is not remembered.
Links only render when the viewer can actually open them — a user without
edit_others_posts for that post type sees the count as plain text rather than a link
into a capability error. Viewing your own row always links, since you can edit your own
posts.
What gets counted
Post types: everything registered as both public and show_ui, minus
attachment. That pair is what separates editorial content from infrastructure post
types — plugins register plenty of types with show_ui but public => false
(wp_block, wp_navigation, acf-field-group), and those are settings, not content.
The column deliberately does not check post_type_supports( $type, 'author' ). That
flag only reports whether the editor shows an author panel, which many sites switch off;
every posts row still carries a real post_author, and those rows are what the column
exists to surface.
Post statuses: publish, future, draft, pending, private. Drafts and pending
posts count on purpose — an account with thirty drafts is not safe to delete, and a
published-only count would imply it was. auto-draft, trash and inherit are
excluded.
Performance
The column is one database query per page load, not one per row. count_user_posts()
would run a query per user per post type — a 20-row users list on a site with ten CPTs
is 200 queries — so the column instead runs a single grouped aggregate covering every
user on the page, primed on the first cell it renders.
Filters
yoko_core_user_post_counts_post_types
Change which post types the column counts. Keys are post type names, values are
WP_Post_Type objects.
// Drop Content Blocks Builder's block-definition types from the breakdown.
add_filter(
'yoko_core_user_post_counts_post_types',
function ( $post_types ) {
unset( $post_types['boldblocks_block'], $post_types['boldblocks_variation'], $post_types['boldblocks_pattern'] );
return $post_types;
}
);
// Count media alongside everything else.
add_filter(
'yoko_core_user_post_counts_post_types',
function ( $post_types ) {
$post_types['attachment'] = get_post_type_object( 'attachment' );
return $post_types;
}
);
yoko_core_user_post_counts_statuses
Change which post statuses count.
// Published content only.
add_filter(
'yoko_core_user_post_counts_statuses',
function () {
return array( 'publish' );
}
);
Debugging
Read the same numbers from the command line — useful when the admin is too slow to page through, or to confirm the column matches the database:
wp yoko user_post_counts
wp yoko user_post_counts admin
wp yoko user_post_counts --hide-empty --format=json
See WP-CLI Commands for the full command reference.
To check one user's numbers in isolation:
wp eval 'print_r( YokoCo\Admin\UserPostCounts::get_post_counts( array( 1 ) ) );'
To confirm which post types are in scope on a given site:
wp eval 'print_r( array_keys( YokoCo\Admin\UserPostCounts::get_counted_post_types() ) );'
Code
includes/Admin/UserPostCounts.php, initialized from YokoCore::init().