Is there a filter/action to add content to WP admin metaboxes?

I couldn’t find a hook so I went with the JS option. add_action( “admin_head-post-new.php”, ‘meta_box_instruction’ ); //new post add_action( “admin_head-post.php”, ‘meta_box_instruction’ ); //edit post function meta_box_instruction($d) { global $post; if($post->post_type == ‘{YOUR POST TYPE}’ || $_GET[‘post_type’] == ‘{YOUR POST TYPE}’): ?> <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(‘<p>Some instruction</p>’).insertBefore(‘#taxonomy-{YOUR TAXONOMY NAME}’).parent(); }); </script> <?php endif; }

How are terms connected with posts in database?

The posts are related to taxonomies (taxonomy/tag) in the wp_3_term_relationships table, where the object_id column is the post’s id, and the term_taxonomy_id is the taxonomy/tag id. Depending on what you want to accomplish, the solution might be to create the same taxonomies at each blog. This way the tax_query should work as normal.

Elegant way to add parent categories?

wp_set_post_terms() uses wp_set_object_terms(). There is an action hook called set_object_terms which fires on successful setting of an object’s terms. The action hook looks like this do_action ( ‘set_object_terms’, int $object_id, array $terms, array $tt_ids, string $taxonomy, bool $append, array $old_tt_ids ) What we can do here is, inside our action callback function, we can check … Read more

Child terms from multiple parents?

We can filter the generated SQL query through the terms_clauses filter before the SQL query is executed. What we will be doing is to introduce a new parameter called wpse_parents which will accept an array of parent term ID’s to get children from. Note, this new parameter works exactly the same as the build-in parameter, … Read more

wp_list_categories: order by term order?

The wp_list_categories() function calls the get_categories() function, that’s a wrapper for the get_terms() function, that creates an instance of the WP_Term_Query class. It doesn’t look like it supports ordering by term order. If the plugin uses the term_order column in the wp_terms table, then you can try to add a support for it’s ordering, via … Read more

List Hierarchical Term List with Count with Related Term

I’ve done something like this in the Query Multiple Taxonomies plugin: https://github.com/scribu/wp-query-multiple-taxonomies/blob/master/core.php The good news is that it’s a generic solution: it works for any combination of posts and taxonomies. The bad news is that it might take some effort to figure out how it’s done.