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 am building a movie site, here is the codes to get the taxonomies

function display_post_taxonomies( $content ) {

    if( is_single() ) {

        $args = array( 'public' => true, '_builtin' => false );

        $output = 'objects';

        $operator = 'and';

        $taxonomies = get_taxonomies( $args, $output, $operator );

        if( $taxonomies ) {

            $content .= '';

            foreach( $taxonomies as $taxonomy ) {

                $args = array(
                                'orderby'               => 'name',
                                'echo'                  => false,
                                'taxonomy'              => $taxonomy->name,
                                'title_li'              => '' . __( $taxonomy->labels->name, 'your-themes-text-domain' ) . '',
                                'show_option_none'      => __( 'No ' . $taxonomy->labels->name, 'your-themes-text-domain' )

                $content .= '
    ' . wp_list_categories( $args ) . '
'; } $content .= ''; } } return $content; }

The first $args is generic to display all not built in taxonomies, but I want to exclude couple of taxonomies but I couldn't If I want to show just one taxonomy I'll use this code

$args = array( 'name' => 'actors');

So I've tried the following codes but it didn't work

$args = array( 
 'name' => array( 'actors', 'directors', 'musicians' )

How can I do it? Thanks in advance.

share|improve this question

I believe your error is in the if ( $taxonomies ) statement, I believe you want if ( is_taxonomy( $taxonomy ); ) see this link for further usages.

I'm not at home so I can't test this, but I think the option you present should work, as mentioned here.

$args = array( 
 'name' => array( 'actors', 'directors', 'musicians' )

And I think you should also remove the . from $content .= ''; making it $content = '';, this error repeats itself 3x.

I would also like to know, when you use the code $args = array( 'name' => 'actors'); does the code perform as intended?

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.