Filter through custom taxonomy with an array of taxonomy IDs

First, you can’t enter such expression as second argument in get_term(). Enter directly the name of your taxonomy… Are you dealing with simple post categories? If that’s the case, your taxonomy name is ‘category’. $context[‘single_term’] = get_term( $user_terms_array[1], ‘category’ ); Second, ensure that $user_terms_array contains term IDs as integer. $user_terms_array = array_map( ‘intval’, explode( ‘-‘, … Read more

Custom Taxonomy template not display

There are a couple of different solutions if you want to have only the /holliday/project-location/ URL and not separate archive and taxonomy URLs. Option 1: Use the template_include() filter. I think this code would work but have not tested: add_filter( ‘template_include’, ‘holliday_template’, 99 ); function holliday_template( $template ) { if ( is_post_type_archive( ‘holliday’ ) ) … Read more

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

Hide taxonomy when term is empty

Lots of Automattic themes do exactly this for standard tags and categories The Underscores starter theme, too. Straight from its source code up on GitHub: $categories_list = get_the_category_list( esc_html__( ‘, ‘, ‘_s’ ) ); if ( $categories_list ) { /* translators: 1: list of categories. */ printf( ” . esc_html__( ‘Posted in %1$s’, ‘_s’ ) … Read more

Custom post type Category Display

The problem is not that you never specify which event cat in your query, but that you’re doing a query at all. If you want to change what the main query pulls in, change the query, don’t add a second query. We do this via the pre_get_posts filter: This hook is called after the query … 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>”; …

Removing custom taxonomies from the admin menu

Referencing register_taxonomy() https://codex.wordpress.org/Function_Reference/register_taxonomy show_in_menu Where to show the taxonomy in the admin menu. show_ui must be true. Default: value of show_ui argument ‘false’ – do not display in the admin menu ‘true’ – show as a submenu of associated object types

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

Advanced search redirecting to another page then filter further

You should use manual sql queries to fetch the records as per your customized requirement and filters rather than the query function. Otherwise install a plugin that creates advanced search form with filters. I am also sharing a reference link below which might be useful for you: http://www.wpbeginner.com/wp-tutorials/how-to-create-advanced-search-form-in-wordpress-for-custom-post-types/ If none of it helps, do mention … Read more

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