Term Meta WordCamp Paris 2016

Eb626a72f75d105a36675aad276ae5dc?s=47 Matt Perry
February 06, 2016

Term Meta WordCamp Paris 2016

This presentation tells the story of the new Term Meta feature in WordPress 4.4, and provides a view of the human and technical story behind this new feature.

Eb626a72f75d105a36675aad276ae5dc?s=128

Matt Perry

February 06, 2016
Tweet

Transcript

  1. term meta Matt Perry /// @mattoperry

  2. what’s new

  3. what’s new how it works

  4. what’s new how it works a cool story

  5. meta data

  6. post, user, comment

  7. post, user, comment term

  8. post, user, comment term a single tag, category or member

    of a custom taxonomy
  9. June 13, 2009

  10. sirzooro (Daniel) https://core.trac.wordpress.org/ticket/10142

  11. plugin developers had to develop their own method of storing

    data [for taxonomy terms] … it would be good to add new functions for this.
  12. None
  13. February 10, 2008

  14. rmccue (Ryan) https://core.trac.wordpress.org/ticket/5809

  15. 1. create a category called Testing 2. create a tag

    called Testing 3. Rename the Testing category to “Another Test” 4. check the name of the tag
  16. 08 09 10 11 12 13 14 15 16

  17. 08 09 10 11 12 13 14 15 16 4.2

    4.4
  18. Why so long?

  19. deep problem upgrade path backward compatibility

  20. wp_users wp_comments wp_posts wp_usermeta wp_commentmeta wp_postmeta < 4.2

  21. wp_users wp_comments wp_posts wp_usermeta wp_commentmeta wp_postmeta wp_terms wp_term_taxonomy < 4.2

    wp_term_relationships
  22. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships

  23. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships what unique terms exist? term

    slugs unique
  24. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships what unique terms exist? term

    slugs unique what terms are in what taxonomies?
  25. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships what unique terms exist? term

    slugs unique what terms are in what taxonomies? what taxonomy terms are associated with which posts
  26. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships what unique terms exist? term

    slugs unique what terms are in what taxonomies? what taxonomy terms are associated with which posts
  27. < 4.2

  28. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships

  29. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships

  30. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships

  31. wp_terms wp_term_taxonomy < 4.2 wp_term_relationships

  32. shared terms

  33. July, 2013

  34. Nacin https://make.wordpress.org/core/2013/07/28/ potential-roadmap-for-taxonomy-meta-and-post- relationships/

  35. Nacin Boone https://make.wordpress.org/core/2013/07/28/ potential-roadmap-for-taxonomy-meta-and-post- relationships/ https://make.wordpress.org/core/2015/09/04/ taxonomy-term-metadata-proposal/

  36. The Plan • Stop making things worse (don’t make any

    new shared terms) • Start to fix shared terms on update • Split all remaining shared terms, establishing a one-to- one correspondence between rows in wp_terms and wp_term_taxonomy • introduce term_meta • combine wp_terms and wp_taxonomy_terms tables
  37. The Plan • Stop making things worse (don’t make any

    new shared terms) [4.1] • Start to fix shared terms on update • Split all remaining shared terms, establishing a one-to- one correspondence between rows in wp_terms and wp_term_taxonomy • introduce term_meta • combine wp_terms and wp_taxonomy_terms tables
  38. The Plan • Stop making things worse (don’t make any

    new shared terms) [4.1] • Start to fix shared terms on update [4.2] • Split all remaining shared terms, establishing a one-to- one correspondence between rows in wp_terms and wp_term_taxonomy • introduce term_meta • combine wp_terms and wp_taxonomy_terms tables
  39. The Plan • Stop making things worse (don’t make any

    new shared terms) [4.1] • Start to fix shared terms on update [4.2] • Split all remaining shared terms, establishing a one-to- one correspondence between rows in wp_terms and wp_term_taxonomy [4.3] • introduce term_meta • combine wp_terms and wp_taxonomy_terms tables
  40. The Plan • Stop making things worse (don’t make any

    new shared terms) [4.1] • Start to fix shared terms on update [4.2] • Split all remaining shared terms, establishing a one-to- one correspondence between rows in wp_terms and wp_term_taxonomy [4.3] • introduce term_meta [4.4] • combine wp_terms and wp_taxonomy_terms tables
  41. The Plan • Stop making things worse (don’t make any

    new shared terms) [4.1] • Start to fix shared terms on update [4.2] • Split all remaining shared terms, establishing a one-to- one correspondence between rows in wp_terms and wp_term_taxonomy [4.3] • introduce term_meta [4.4] • combine wp_terms and wp_taxonomy_terms tables [?]
  42. wp_terms wp_term_taxonomy 4.4 wp_term_relationships wp_term_meta

  43. • add_term_meta, update_term_meta, get_term_meta, delete_term_meta • same underlying API (ie:

    get_metadata) • meta_query argument for get_terms • cache priming for functions that fetch terms (can be turned off via a filter)
  44. Applications

  45. None
  46. None
  47. None
  48. None
  49. https://www.smashingmagazine.com/2015/12/ how-to-use-term-meta-data-in-wordpress/ Thomas Maier http://themehybrid.com/weblog/introduction-to- wordpress-term-meta Justin Tadlock

  50. @todo combine wp_terms and wp_taxonomy_terms

  51. wp_terms wp_term_taxonomy SOME_NEW_TABLE

  52. None
  53. None
  54. None
  55. None
  56. None
  57. None
  58. None
  59. None
  60. make.wordpress.org

  61. merci Matt Perry /// @mattoperry