Clean Custom URL for Serach + Custom Taxonomy

With Slam’s kind tip to use query-monitor plugin, I could figure out what the problem was. Apparently the url /search/foo/filter/bar also fits the “general search” rewrite-rule. Makes sense, thinking about it– (.+) technically matches /foo/filter/bar aswell. So I could improve (.+) by excluding /s? But I found an easier solution! In hope “first match wins” … Read more

Custom taxonomy link automatically removing query string and re-directing

WordPress uses the redirect_canonical function in order to ensure that URLs are properly following the current permalink structure: https://codex.wordpress.org/Function_Reference/redirect_canonical The function is hooked to automatically run on the template_redirect filter. In order to remove it, you need to add the following snippet to your theme or plugin: remove_filter( ‘template_redirect’, ‘redirect_canonical’ ); Keep in mind that … Read more

Loop to display ONLY custom taxonomy parent information [closed]

I believe this has already been answered perfectly in How can I get only parent terms?. The solution is to set ‘parent’ => 0 when querying terms with get_terms() or WP_Term_Query. The example from that question looked like this: $myterms = get_terms( array( ‘taxonomy’ => ‘taxonomy_name’, ‘parent’ => 0 ) ); You can easily loop … Read more

wp_dropdown_categories – how to save in widget?

You didn’t add the dropdown/select name attribute, that’s why it’s not working as expected. Please try updating your $dropdown_args, here’s the updated arguments – $dropdown_args = array( ‘taxonomy’ => ‘cs_categories’, ‘id’ => $this->get_field_id( ‘cs-category’ ), ‘name’ => $this->get_field_name( ‘cs-category’ ), // Added this line ‘show_option_none’ => __( ‘Select category’, ‘text-domain’ ), ‘hide_empty’ => true, ‘hierarchical’ … Read more

Can’t get taxonomy ID for each post on archive page

From the help of the comments above I needed to use get_term_terms to print the ID. I used the code below to achieve what I needed: <?php $terms = get_the_terms( $post->ID, ‘producers_assessment’ ); foreach($terms as $term) {?> <?php $image = get_field(‘badge’, ‘producers_assessment_’ . $term->term_id); if( !empty($image) ): ?> <img src=”https://wordpress.stackexchange.com/questions/295839/<?php echo $image[“url’]; ?>” alt=”https://wordpress.stackexchange.com/questions/295839/<?php echo … Read more

Adding a custom taxonomy to “nav_menu_item”

This is not how you enable adding your taxonomy terms to menus. To do that you just set show_in_nav_menus to true when registering the taxonomy. You have it set to false. $args = array( ‘labels’ => $labels, ‘hierarchical’ => true, ‘public’ => true, ‘show_ui’ => true, ‘show_admin_column’ => true, ‘show_in_nav_menus’ => true, // This ‘show_tagcloud’ … Read more