redirecting improperly after updating custom taxonomy term when referring from CPT edit page

Got it! I’m not sure exactly what the culprit was, but I did a few things that resulted in it working. Here’s a summary of the code I used: I defined this helper function based on code found in redirect_cannonical() function get_current_url() { $current_url = is_ssl() ? ‘https://’ : ‘http://’; $current_url .= $_SERVER[‘HTTP_HOST’]; $current_url .= … Read more

Querying two taxonomies

This helper function will return the ID of the term you are currently viewing (from any taxonomy – you can limit just to a specific taxonomy, or the built-in tag and category taxonomies). It will return false if you are not on a taxonomy term archive page. function wpse52578_get_current_term_id(){ if( !is_tax() && !is_tag() && !is_category() … Read more

Custom Post Types, URL rewrite on multiple CPTs

Assuming the code snippet provided works then extending the conditional statement like so will help you, function filter_post_type_link($link, $post) { if ($post->post_type=”custom_post_type_1″) { if ($cats = get_the_terms($post->ID, ‘custom_cat_1’)) $link = str_replace(‘%custom_cat_1%’, array_pop($cats)->slug, $link); return $link; } elseif ($post->post_type=”custom_post_type_2″) { if ($cats = get_the_terms($post->ID, ‘custom_cat_2’)) $link = str_replace(‘%custom_cat_2%’, array_pop($cats)->slug, $link); return $link; } else { return … Read more

Query Custom posts of same taxonomy as the post itself

Assuming you want it for all the terms in the ‘Genre’ taxonomy. In the loop on the single Service post page, put this code: <?php $the_terms = get_the_terms( get_the_ID, ‘genre’ ); if(isset($the_terms) && !empty($the_terms)){ foreach($the_terms as $the_term){ $the_terms_slugs[] = $the_term->slug; } } $works = get_posts(array( ‘post_type’ => ‘works’, ‘posts_per_page’ => 5, ‘tax_query’ => array(array( ‘taxonomy’ … Read more

Show only the grandchildren (using get_terms)

I think for each term you should check that it has a parent but not have any childern So you code may look like $taxonomy = ‘world’; $tax_terms = get_terms( $taxonomy ); foreach ($tax_terms as $value){ $args=array( ‘child_of’=> $value->term_id, ); //get all child of current term $child = get_terms( $taxonomy, $args ); if( $value->parent != … Read more

User: Editor, can’t see edit taxonomy screen

Right after I wrote the posts I found it…anyway if someone else is looking for the answer to this, you need to set capabilities when you register your taxonomy. You add the following: ‘capabilities’ => array ( ‘manage_terms’ => ‘edit_posts’, ‘edit_terms’ => ‘edit_posts’, ‘delete_terms’ => ‘edit_posts’, ‘assign_terms’ => ‘edit_posts’ ) edit_posts means administrator’, ‘editor’, ‘author’ … Read more