Opened 9 months ago

Closed 9 months ago

#21578 closed enhancement (duplicate)

Introducing term_metas

Reported by: hughwillfayle Owned by:
Priority: normal Milestone:
Component: Taxonomy Version:
Severity: normal Keywords: dev-feedback has-patch
Cc:

Description

In pur work with WordPress we search for many solutions to have term metas. We found one which we can implement easily and it has been tested in some client projects. Based upon a plugin I'd like to contribute the API functions and the schematic to the core.

get_term_meta( $term_id, $key = '', $single = FALSE )
update_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' )
delete_term_meta_by_key( $term_meta_key )
get_term_custom( $term_id = 0 )
get_term_custom_keys( $term_id = 0 )
get_term_custom_values( $key = '', $term_id = 0 )

Attachments (2)

term_meta.diff (5.0 KB) - added by hughwillfayle 9 months ago.
Removed unneccessary deletions
term_meta.2.diff (5.0 KB) - added by hughwillfayle 9 months ago.
Replaced Doc Errors

Download all attachments as: .zip

Change History (4)

Removed unneccessary deletions

Replaced Doc Errors

Related: #19048, #10142

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

A "term_id" is not actually unique to a term in the general sense. It is unique to a single, unique name and slug pair. But it may exist in multiple taxonomies. That's the point of the term_taxonomy_id. So, "Apple" may be in the fruit taxonomy and the company taxonomy. But metadata stored against "Apple" doesn't make sense — you'll want to store it against "Apple" + fruit or "Apple" + company.

This is why our API passes around term_id + taxonomy to uniquely identify a term, as together they are synonymous to term_taxonomy_id.

This is a duplicate of #10142. There it is outlined why we have not done this yet, and what we'll need to do first to be able to do this in the future.

Note: See TracTickets for help on using tickets.