Update wpseo (Yoast) term title and description programmatically
Yoast metadata terms are stored in a row in the options table called “wpseo_taxonomy_meta”. The meta value of this option row contains a serialized string with all the SEO metadata for each term. To update the metadata of a WordPress term you can use the WPSEO_Taxonomy_Meta::set_value( $term_id, $taxonomy, $meta_key, $meta_value ) function. To for example […]
Get terms with a parent
With the following function you can return only the terms with a parent term (so are child terms), by post id and taxonomy. Notice that there terms also can be parents when using multiple levels of hierarchy.
Get first term by post id
With the following function you can get the first term of a post by the post’s id. The function requires 3 parameters: $post_idThe id of the post to retrieve the term from. $taxonomyThe taxonomy to retrieve terms from. $outputWhat you want to return from the term. (term_id, name, slug, description etc.).