[wp-hackers] Meta tables: Take 5

scribu scribu at gmail.com
Fri Jul 24 19:36:09 UTC 2009


On Fri, Jul 24, 2009 at 10:01 PM, Otto <otto at ottodestruct.com> wrote:

> On Fri, Jul 24, 2009 at 12:21 PM, scribu<scribu at gmail.com> wrote:
> > We need to think how to map these functions:
> > get_post_custom($id);
> > get_post_custom_keys($id);
> > get_post_custom_values($id);
>
> Don't worry about those existing functions. Implement the base, then
> they can be rewritten to use the new base functions and provide
> backward compatibility.


It's the base functions that I'm thinking about. This is a revised list:


register_meta_type($type);


Single key=value pair:

 function add_meta($type, $id, $key, $value, $single);

function update_meta($type, $id, $key, $value, $old_value);

function get_meta($type, $id, $key, $value, $single);

function delete_meta($type, $id, $key, $value);


By id:

get_meta_by_id($type, $id);

delete_meta_by_id($type, $id);


By key:

get_meta_by_key($type, $key);

delete_meta_by_key($type, $key);


By type:

get_meta_by_type($type);

delete_meta_by_type($type);


We could also have convenience functions like these:

get_meta_values_by_*()

get_meta_keys_by_*()


-- 
http://scribu.net


More information about the wp-hackers mailing list