[wp-hackers] Showing users post counts for custom post types

scribu mail at scribu.net
Sun Oct 24 15:59:18 UTC 2010


On Sun, Oct 24, 2010 at 7:25 AM, Jared Williams <jaredwilli at gmail.com>wrote:

> Hi,
>
> I'm trying to figure out how to hook into the users.php manage page to
> create custom columns for showing the number of posts users have for my
> custom post types. I created a trac
> ticket<http://core.trac.wordpress.org/ticket/15200>for this, but
> @nacin explained why it's a job more for a plugin to do
> instead, so I turned here.
>
> I have been unable to find a way to manipulate the output of the users
> table, so I can add custom columns for CPTs post counts for each user. And
> that may have something to do with the question @nacin asked, what would
> the
> post count numbers link to. For the current 'post' post count a user has,
> it
> links to the post manage page, showing all posts for that user
> (edit.php?author=ID#).
>
> If I were to link it somewhere, it would be to
> 'edit.php?post_type=TYPE&author=ID' if that were even somehow possible I
> guess. But I don't even necessarily need to link it to anywhere. I mostly
> want to just show CPT post counts for each person, having 600 users and a
> combined total of 300+ posts across 4 custom post types. Admins are only
> one
> who can submit 'post' posts, so that column in the users page is useless.
>
> Anyone have any tips on hooking into that to do this?
>

First of all, if you're going to be lazy and reply to a thread to open a new
topic (you should send a clean email instead), at least don't quote the old
topic in your message.

Secondly, there's no way to alter an existing column at the moment. The best
you can do is register a new column and unset the one you're trying to
overwrite.

Here's a tutorial I wrote for the posts screen:
http://scribu.net/wordpress/custom-sortable-columns.html

Just ignore the sortable part and replace 'edit-post' with 'users'.


More information about the wp-hackers mailing list