[wp-trac] [WordPress Trac] #21240: Ability to "Turn On" Native custom columns for registered custom taxonomies
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 7 19:58:00 UTC 2012
#21240: Ability to "Turn On" Native custom columns for registered custom taxonomies
-----------------------------------+------------------------------
Reporter: jtsternberg | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion has-patch |
-----------------------------------+------------------------------
Comment (by nacin):
I've looked at this a number of times but wasn't a diehard fan of the
current approach. Couldn't figure out why exactly. Today in IRC I started
to [https://irclogs.wordpress.org/chanlog.php?channel=wordpress-
dev&day=2012-09-07&sort=asc#m452937 offer a review] of the patch. There
are some smaller things pointed out there like column and taxonomy names
conflicting, overly clever code, etc.
I don't think that tying this directly to register_post_type() is
particularly useful. First, this kind of modification is just as likely to
. Second, it'd probably make more sense for it to be controlled by
register_taxonomy(), as that's what is being shown, and they are
specifically being registered against a post type anyway. It also makes
for really complicated code.
People are used to registering a custom column with one filter (which is
very simple to do). Then, they are used to registering a callback against
an action to handle output of the column's contents, row by row. Not much
harder to do, but it's annoying when all you want is a taxonomy column.
You have to replicate the 'tags' code from the list table. That's no fun,
and that's really what (I think) this ticket is trying to get at.
So, [attachment:21240.7.diff].
It simply abstracts out the code used to render both 'categories' and
'tags' columns. For compatibility with the column management filters, it
keeps the names for both of those columns, translating them back and forth
as necessary with 'category' and 'post_tag'.
For the other taxonomies, a 'taxonomy-{$taxonomy}' column is automatically
registered based on the taxonomy names returned from a new
`manage_taxonomies_for_{$post_type}_columns` filter. If the post type
supports categories or tags, those are automatically passed to the filter
as a starting point.
The only other thing I would possibly add here is a
show_column_on_post_screens-like argument (that name is terrible, I know)
to register_taxonomy(). If true, then that taxonomy will be a column by
default (passed to the filter the same way categories and tags are now),
for all post types to which it is registered.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21240#comment:24>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list