[wp-trac] [WordPress Trac] #14558: Separate Database Table Support for Custom Post Types
WordPress Trac
wp-trac at lists.automattic.com
Sat Aug 7 06:55:07 UTC 2010
#14558: Separate Database Table Support for Custom Post Types
-------------------------+--------------------------------------------------
Reporter: rahul286 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Types | Version:
Severity: normal | Keywords: post type, database
-------------------------+--------------------------------------------------
While working on custom post types, I felt need for this enhancements.
This can be achieved by adding an extra argument to the register_post_type
function like below...
{{{
register_post_type( 'acme_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
/* Database separation */
'db_tables' => array(
'prefix' => '', //by default, value of $table_prefix will be used.
If user sets this value to something, it will be used as prefix for both
of following tables
'base_prefix' => '' , //this will control it tables are to be kept
sitewide or per blog
'posts_name' => 'acme',
'postmeta_name' => 'acmemeta',
),
);
}}}
This small enhancement (not from coding perspective) will help more
plugins authors go for custom post type.
Reasons are - first they will get option to have separate data storage.
Second - if some other badly coded plugin manipulates wp_posts table in
some wrong way, it won't have sideeffect on third-party data.
Third - Plugin authors will get more space to experiment as at any time
they will be dealing with their own plugin's data.
Of course, one of the goal of this nice feature must be to abstract
database layer, but as a developer I feel it would be better if I can have
some control over database without loosing power of this new (custom post
type) feature.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14558>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list