How to save taxonomy term meta?

Since, WordPress don’t have taxonomy metadata support for saving taxonomy custom form fields, I am currently thinking of using options API. But the 1MB options size limit on WordPress.com is what’s troubling me. Originally, I had thought of adding an option say ‘my_plugin_term_meta’, which will then have term meta indexed by the term taxonomy id(not to be confused with term id).

But, since, this gives rise to scalability issues, I am now thinking of saving term meta in multiple options as ‘my_plugin_term_meta_{$tt_id}’. However, I am worried that on larger sites with lots of terms, this will pollute the options table.

So, here I am asking how should I save the taxonomy term meta, considering, I don’t want to use wp large options(don’t want add any extra dependency) and custom table.

Thanks!

1 Answer
1

As of WordPress 4.4, Taxonomy term meta is now a part of WordPress.

You can use the following new functions to manage term meta:

  • add_term_meta
  • update_term_meta
  • get_term_meta

Leave a Comment