[wp-hackers] WP 3.0 and beyond: Custom post types + custom fields
logikal16 at gmail.com
Fri Jun 18 20:30:42 UTC 2010
Now that the custom post type functionality has been refined with 3.0, one
important next step would be to more closely integrate post types with
There's no easy way -- using only core -- to assign certain custom fields to
a new post depending on its post type.
For example, a new "Soccer Team" post type. You'd likely want to see custom
fields like "wins", "losses", "home_field", and "roster" (some sort of
relationship) show up by default when adding a new Soccer Team.
The closest thing I could find was the "register_meta_box_cb" argument,
which lets you add new meta boxes -- not alter the "Custom Fields" area.
Here's a *really* rough idea of how this functionality could work:
$args = array(
'public' => true,
'publicly_queryable' => true,
'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
'custom_fields' => array(
'wins' => array('label' => __('Wins'), 'widget' => 'number'),
'losses' => array('label' => __('Losses'), 'widget' => 'number',
'default' => 0),
'home_field' => array('label' => __('Home Field'), 'widget' =>
... etc ...
Has any serious thought been given towards this aspect of WP? There are
several plugins out there that attempt to tackle this in various ways. I'm
curious as to if there's much interest in this making it into core, and if
so, what steps have been made thus far.
More information about the wp-hackers