How to extract one field from wp_get_post_terms objects?

$terms is an array of objects. You must select one of the array entries before you can reference its properties (fields). This will print the ‘name’ of the first object (index zero): if ($terms) { echo $terms[0]->name; } This will print all the ‘name’ fields: if ($terms) { foreach( $terms as $term ) echo $term->name; … Read more

How to display taxonomy terms the way they are hierarchical

term_group seemed to have never been fully developed together with the alias_of parameter. What the exact indended use is (or was), I cannot say for sure. I would just rather avoid the use of those two parameters. Regarding your issue of creating a hierarchical tree, wp_list_categories() immediately jumps to mind (remember this works for custom … Read more

Urls in Custom Post Type work for Terms but not for its Taxonomies

[taxonomy_name] should be available in permalink automatically if you register it as register_taxonomy(‘kalendar’, [taxonomy_name], $args ); So Try this foreach($this->months as $month => $month_var) : $args = array( ‘labels’ => array(‘name’ => $month), ‘hierarchical’ => true, ‘rewrite’ => array( ‘slug’ => $month_var ), ‘query_var’ => true ); register_taxonomy($month_var, ‘kalendar’, $args); endforeach; Then Save Permalink Settings … Read more

How to get term by name with parent id?

Use get_terms and specify name and parent. $name=”Flowers”; $parent_id = 42; $args = array( ‘name’ => $name, ‘parent’ => $parent_id ); $terms = get_terms( ‘category’, $args );

Create a a form for custom taxonomy terms

at the simplest level, you could put the options in a select list which would allow a user to ctrl + click to select multiple terms for your form submission. (For something fancier, use javascript/jquery/etc) You can then write a return function that uses wp_query to filter on the terms (you didn’t specify if you … Read more

Temporarily un-associate term for an amount of time

I think since the users are a CPT, it would be well suited to do this in post_meta on the user. You could store the temporarily unsubscribed term there and check against when sending notifications. For example, your post_meta could be an array such as this: subscribed_list_term => “maybe_cool_for_summer_list_term”, subscription_duration => “halted_during_all_seasons_but_summer” Obviously that is … Read more