[wp-hackers] Meta tables: Take 5
scribu
scribu at gmail.com
Fri Jul 24 10:21:31 UTC 2009
Yes, this subject has been discussed a lot recently, both on trac, as well
as on the dev chat. But I think the solution I'm about to propose has been
overlooked. It is based on two principles:
- WP core shouldn't create tables that it doesn't use. The same principle is
applied to bundled javascript and php classes.
- Having a combined meta table for all, or most, object types makes for bad
performance, especially when we consider MU instalations.
So, I propose that Core have an API for creating standard meta tables for
whatever plugins need.
Of course, this would be accompanied by unified functions for handling meta
data in said tables.
Example: A plugin needs a comment meta table. First, it makes sure it's
available:
register_activation_hook(__FILE__, 'example_plugin_activation');
function example_plugin_activation() {
enable_meta_table('comment');
}
Then, it uses it to store data, etc.:
...
add_meta('comment', $comment_id, $meta_key, $meta_value);
...
I am willing to code this API, if people think it's a sound ideea.
By the way, I also wrote a blog post about this:
http://scribu.net/wordpress/meta-tables-for-wordpress.html
--
http://scribu.net
More information about the wp-hackers
mailing list