Fieldmanager_Util_Term_Meta deprecated
class Fieldmanager_Util_Term_Meta (View source)
deprecated
Use Fieldmanager to store meta data for taxonomy terms.
This is deprecated as of WordPress 4.4, which introduces term meta into core. If you were using this feature prior to 4.4, it will continue to operate until probably WordPress 4.8, however it is in your best interest to migrate your data ASAP, as core's term meta is significantly more efficient.
Methods
Singleton helper
Sets up the class.
Create the custom content type.
Get the slug (post_name and post_title) for the fm_term_meta post.
Get metadata matching the specified key for the given term ID/taxonomy pair.
Add metadata to a term ID/taxonomy pair.
Update metadata for a term ID/taxonomy pair.
Remove metadata matching criteria from a term ID/taxonomy pair.
Handles checking if post exists and returning its ID to store taxonomy term meta data.
Generates a standardized cache key for the term meta post ID.
Clears the cache for a term meta post ID.
Handles adding a post to store taxonomy term meta data.
When a term is deleted, delete its ghost post and related meta.
Update term meta when a shared term gets split (as of WordPress 4.2).
Details
static object
instance()
Singleton helper
setup()
Sets up the class.
create_content_type()
Create the custom content type.
protected string
post_slug(int $term_id, string $taxonomy)
Get the slug (post_name and post_title) for the fm_term_meta post.
string|array
get_term_meta(int $term_id, string $taxonomy, string $meta_key = '', bool $single = false)
Get metadata matching the specified key for the given term ID/taxonomy pair.
bool|int
add_term_meta(int $term_id, string $taxonomy, string $meta_key, mixed $meta_value, bool $unique = false)
Add metadata to a term ID/taxonomy pair.
mixed
update_term_meta(int $term_id, string $taxonomy, string $meta_key, mixed $meta_value, mixed $meta_prev_value = '')
Update metadata for a term ID/taxonomy pair.
Use the $prev_value parameter to differentiate between meta fields with the same key and post ID.
If the meta field for the term does not exist, it will be added.
bool
delete_term_meta(int $term_id, string $taxonomy, string $meta_key, mixed $meta_value = '')
Remove metadata matching criteria from a term ID/taxonomy pair.
You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.
int|bool
get_term_meta_post_id(int $term_id, string $taxonomy)
Handles checking if post exists and returning its ID to store taxonomy term meta data.
string
get_term_meta_post_id_cache_key(int $term_id, string $taxonomy)
Generates a standardized cache key for the term meta post ID.
delete_term_meta_post_id_cache(int $term_id, string $taxonomy)
Clears the cache for a term meta post ID.
bool
add_term_meta_post(int $term_id, string $taxonomy)
Handles adding a post to store taxonomy term meta data.
collect_garbage(int $term_id, int $tt_id, string $taxonomy)
When a term is deleted, delete its ghost post and related meta.
split_shared_term(int $old_term_id, int $new_term_id, int $term_taxonomy_id, string $taxonomy)
Update term meta when a shared term gets split (as of WordPress 4.2).