WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code that gets the slug of the taxonomy "author" from a custom post type "books" and gets the post from another custom post type "authors" that has the same slug.

<?php

global $post;
$bookauthor = wp_get_post_terms( $post->ID, 'author' );
$slug = array_shift( $bookauthor );
$custom_query = new WP_Query( array( 'post_type' => 'authors','name' => $slug->slug ) );

if($custom_query->have_posts()) : 
while($custom_query->have_posts()) : 
$custom_query->the_post();

?>

Now I need to get the slug of a child taxonomy of "author" called "new-author" but don't know how to modify the code.

Suggestions welcome!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.