Replace term archives with static pages

I think this should work if library functions are used everywhere. function custom_term_archive_link($url, $term, $taxonomy) { if($taxonomy != ‘product_cat’) { return $url;} if( $term->name == ‘my_term’ ) { $url=”my_term_static_url”; } return $url; } add_filter(‘term_link’, ‘custom_term_archive_link’, 99, 3);

Adding Taxonomy Image to taxonomy loop [closed]

You should you this plug in instead: Category Image And don’t be shy learning and using printf, it’s worth. printf( ‘<a class=”%1$s” href=”https://wordpress.stackexchange.com/questions/223745/%2$s”><img class=”img-class” src=”%4$s” <h3>%3$s</h3></a>’, sanitize_html_class( $class_name ), get_tag_link( $tag->term_id ), sprintf( __( ‘%s’) , $tag->name ), z_taxonomy_image_url($tag->term_id, ‘thumbnail’ ) ); A note fore easier debugging, you can use var_dump($tag) inside the foreach loop … Read more

Taxonomy archive page WP_Query does not return get_the_permalink() or get_permalink() value

Problem was that I had broken the permalink structure for the CPT with the following filter: function classes_permalink_structure($post_link, $post, $permalink, $sample) { if (strpos($permalink, ‘%classes_class_type%’) === FALSE) return $permalink; // Get post $post = get_post($post_id); if (!$post) return $permalink; // Get taxonomy terms $terms = wp_get_object_terms($post->ID, ‘classes_class_type’); if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = … Read more

Get Posts Under Custom Taxonomy

Your tax query is incorrect, field should be the field you want to query on: term_id, name, or slug – $posts_array = get_posts( array( ‘posts_per_page’ => -1, ‘post_type’ => ‘fabric_building’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘fabric_building_types’, ‘field’ => ‘term_id’, ‘terms’ => $cat->term_id, ) ) ) );

“AND” relation in custom taxonomies

@the_dramatist My functions.php file contains: function core_rewrite_rules() { global $wp_rewrite; $new_rules = array( ‘tax1/(.+?)/tax2/(.+?)/tax3/(.+?)/tax4/(.+?)/tax5/(.+?)/?$’ => ‘index.php?post_type=my-custom-post-type&tax1=’ . $wp_rewrite->preg_index(1) . ‘&tax2=’ . $wp_rewrite->preg_index(2) . ‘&tax3=’ . $wp_rewrite->preg_index(3) . ‘&tax4=’ . $wp_rewrite->preg_index(4) . ‘&tax5=’ . $wp_rewrite->preg_index(4), ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action( ‘generate_rewrite_rules’, ‘core_rewrite_rules’ ); My autogenerated htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On … Read more