The best way to display taxonomies

This has been already answered here Both the loops needs to exist and you can display it however you like. foreach( get_terms( ‘products-category’, array( ‘hide_empty’ => false, ‘parent’ => 0 ) ) as $parent_term ) { // display top level term name echo $parent_term->name . ‘<br>’; foreach( get_terms( ‘products-category’, array( ‘hide_empty’ => false, ‘parent’ => … Read more

How to update a taxonomy term for a custom post type with auto incrementing number

/** * Add an auto-incrementing Project ID field to Design feedback posts */ function auto_assign_ids( $post_id, $post, $update ) { // Only assign ID to new design posts if ( $post->post_status == ‘publish’ && $post->post_type == ‘designapprovalsystem’ ) { // get the most recent Project post $project_args = array( ‘numberposts’ => 2, ‘post_type’ => ‘designapprovalsystem’, … Read more

Get name of taxonomies of current page

The get_object_taxonomies function only returns the slugs of all registered taxonomies to that post type, so you’re almost there. You need to actually go get the taxonomy itself using get_taxonomy() … foreach ( $taxonomies as $taxonomy ) { $tax_object = get_taxonomy( $taxonomy ); $out .= “<li’><span’>” . $tax_object->name . “: “; $out .= “</span>”; …

How to get terms from a custom taxonomies after WordPress 4.5.0

OK, wild guess: $prefix_topic_terms= array(); if ( ! empty( $iva_topic_terms ) ) { vs $prefix_topic_terms = array(); if ( ! empty( $prefix_topic_terms ) ) { You’ve changed the variable that is checked for emptiness in the new code. That code will never query get_terms for that taxonomy, because $prefix_topic_terms will not be empty. The Error-object … Read more

Corrupted nav-menu?

Sounds like you deleted some terms and/or taxonomies related to menus. You need to get those back into the database. Easiest solution is if you took a database backup before removing those terms, as is best practice, just restore your database. Or if the host provides automated backups, use one of those. If you don’t … Read more

Sending comment notifications to different recipients depending on taxonomy terms

Finally I found the right code, if it can be usefull to someone: function sp_comment_moderation_recipients( $emails, $comment_id ) { $comment = get_comment( $comment_id ); $post = get_post( $comment->comment_post_ID ); if ( has_term(‘myterm’,’mytaxonomy’, $post->ID) ) { return array( ‘[email protected]’ ); } return $emails; } add_filter( ‘comment_moderation_recipients’, ‘sp_comment_moderation_recipients’, 10, 2 ); add_filter( ‘comment_notification_recipients’, ‘sp_comment_moderation_recipients’, 10, 2 );

Display children category images

Haven’t tested it, but this should do it. <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); $queried_object = get_queried_object(); $term_id = get_queried_object() -> term_id; $taxonomyName = “product-categories”; $termchildren = get_term_children( $term_id, $taxonomyName ); if (! empty ( $term_children ) ){ foreach ($termchildren as $child) { $image_id = get_term_meta( $child, ‘showcase-taxonomy-image-id’, true … Read more

Blogroll links sorted by category in a table

As suggested, here is the “arrayed” version: $args = array( ‘categorize’ => 1, ‘category_before’ => ”, ‘category_after’ => ‘</table>’, ‘title_before’ => ‘<h3>’, ‘title_after’ => ‘</h3><table><tr><th>Link</th><th>Description</th><tr>’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘before’ => ‘<tr><td>’, ‘after’ => ‘</td></tr>’, ‘between’ => ‘</td><td>’, ‘show_description’ => 1, ‘show_name’ => 1 ); wp_list_bookmarks( $args ); The Highlight of my answer … Read more