Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Term Meta WordCamp Paris 2016

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.

Matt Perry

February 06, 2016
Tweet

Other Decks in Technology

Transcript

  1. term meta
    Matt Perry /// @mattoperry

    View Slide

  2. what’s new

    View Slide

  3. what’s new
    how it works

    View Slide

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

    View Slide

  5. meta data

    View Slide

  6. post, user, comment

    View Slide

  7. post, user, comment
    term

    View Slide

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

    View Slide

  9. June 13, 2009

    View Slide

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

    View Slide

  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.

    View Slide

  12. View Slide

  13. February 10, 2008

    View Slide

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

    View Slide

  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

    View Slide

  16. 08 09 10 11 12 13 14 15 16

    View Slide

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

    View Slide

  18. Why so long?

    View Slide

  19. deep problem
    upgrade path
    backward compatibility

    View Slide

  20. wp_users
    wp_comments
    wp_posts
    wp_usermeta
    wp_commentmeta
    wp_postmeta
    < 4.2

    View Slide

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

    View Slide

  22. wp_terms wp_term_taxonomy
    < 4.2
    wp_term_relationships

    View Slide

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

    View Slide

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

    View Slide

  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

    View Slide

  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

    View Slide

  27. < 4.2

    View Slide

  28. wp_terms wp_term_taxonomy
    < 4.2
    wp_term_relationships

    View Slide

  29. wp_terms wp_term_taxonomy
    < 4.2
    wp_term_relationships

    View Slide

  30. wp_terms wp_term_taxonomy
    < 4.2
    wp_term_relationships

    View Slide

  31. wp_terms wp_term_taxonomy
    < 4.2
    wp_term_relationships

    View Slide

  32. shared terms

    View Slide

  33. July, 2013

    View Slide

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

    View Slide

  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/

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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 [?]

    View Slide

  42. wp_terms wp_term_taxonomy
    4.4
    wp_term_relationships
    wp_term_meta

    View Slide

  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)

    View Slide

  44. Applications

    View Slide

  45. View Slide

  46. View Slide

  47. View Slide

  48. View Slide

  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

    View Slide

  50. @todo combine
    wp_terms and
    wp_taxonomy_terms

    View Slide

  51. wp_terms wp_term_taxonomy
    SOME_NEW_TABLE

    View Slide

  52. View Slide

  53. View Slide

  54. View Slide

  55. View Slide

  56. View Slide

  57. View Slide

  58. View Slide

  59. View Slide

  60. make.wordpress.org

    View Slide

  61. merci
    Matt Perry /// @mattoperry

    View Slide