List related terms + taxonomies

You probaby want get_terms(). WordPress keeps a count of the number of posts that use a taxonomy and you can filter your query using it: // get all the terms in the ‘category’ taxonomy $terms = get_terms(‘knife’); // list all the terms that have at least one post foreach ($terms as $term) { echo “{$term->name} … Read more

How to remove plugin-specific custom taxonomy terms when plugin is uninstalled?

You should be using the register_deactivation_hook and/or register_uninstall_hooks. That may be why some functions don’t work. I’d have to do some testing to be sure, but loading your method directly like WP_Plugin_Janitor::cleanup( $opt, $cpt, $tax ); seems like a pretty good way to skip over some of the WordPress load sequence or to run things … Read more

Can’t set custom taxonomy terms via custom form

Have you tried wp_set_object_terms? …which needs to be placed after your call to wp_insert_post as it requires the post ID in order to attach the correct terms, to the right taxonomy with the right post. //add_action(‘plugins_loaded’, ‘newpost’); # will not work, user not authenticated add_action(‘init’, ‘newpost’); // will work, user authenticated function newpost() { if … Read more