WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#10487 closed feature request (wontfix)

Improved meta API

Reported by: scribu Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: General Keywords:
Focuses: Cc:

Description

Yes, discussions on the topic can be seen here:

#5183 #2659

But they focus on table structure, not on the api. Hence, the new ticket.

Discussions on the api (as well as the table structure) can be found on wp-hackers: and also on wp-hackers: 1 2

Attachments (4)

meta-testing.php (591 bytes) - added by scribu 6 years ago.
plugin for basic testing
meta_api.diff (14.0 KB) - added by scribu 6 years ago.
first draft
meta-testing.2.php (744 bytes) - added by scribu 6 years ago.
plugin for basic testing
meta_upgrade.diff (1.3 KB) - added by scribu 6 years ago.
code to migrate data to new table

Download all attachments as: .zip

Change History (11)

comment:1 @scribu6 years ago

This patch:

  • replaces postmeta with a generic meta table
  • the meta table has enum as meta_type for better performance
  • implements these functions:
register_meta_type($meta_type);

add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false);

update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '');

delete_metadata($meta_type, $object_id, $meta_key = '', $meta_value = '');

get_metadata($meta_type, $object_id, $key = '', $single = false);

Notice that $meta_key is optional for delete_metadata() and get_metadata().

  • maps these functions:
add_post_meta();

update_post_meta();

delete_post_meta();

get_post_meta();

get_post_custom();

@scribu6 years ago

plugin for basic testing

@scribu6 years ago

first draft

comment:2 @scribu6 years ago

What's still needed is code to migrate data from postmeta to meta.

@scribu6 years ago

plugin for basic testing

@scribu6 years ago

code to migrate data to new table

comment:3 @aaroncampbell6 years ago

  • Cc aaroncampbell added

comment:4 @scribu6 years ago

  • Keywords early added; dev-feedback removed

comment:6 @scribu6 years ago

  • Keywords has-patch needs-testing early removed
  • Version set to 2.9

We now have a generic meta API. How do we make it more flexible?

comment:7 @ryan5 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing since we're not doing generic meta.

Note: See TracTickets for help on using tickets.