and thanks for any help!.

I'm trying to display all of the tags except ones that start with a token ("Author: ").

I have figured out how to exclude a single tag (just typed it into the exclude parameter).

I have figured out how to exclude an array of tags (created an array and manually added a couple of values).

But I haven't figured out how to fill the array based on get_term_by (or whether or not that is the best way to approach this).

<div id="tagarea">
<div class="contained">
    //$excludetags = array(136,135);
    $excludetags = get_term_by('name', 'Author:*','post_tag');
    $args = array(
    'separator'                 => " ... ",
    'orderby'                   => 'name',
    'order'                     => 'ASC',
    'exclude'                   => $excludetags,
    'include'                   => null,
    'topic_count_text_callback' => default_topic_count_text,
    'link'                      => 'view',
    'taxonomy'                  => 'post_tag',
    'echo'                      => true,
    'child_of'                  => null, // see Note!
<?php wp_tag_cloud( $args ); ?>

I also tried

$excludetags = array(get_term_by('name', 'Author:*','post_tag'));

but that doesn't work, either.

  • What precisely did you try to express with Author:* ? Is that literally name of the term? Are you trying to retrieve multiple terms with wildcard?
    – Rarst
    Mar 3, 2015 at 19:09
  • Sorry I didn't make that clearer. The blog is functioning as a literary magazine, so there are WP Authors and then there are the authors (writer) of the pieces we post. For each writer, we'll create a tag, it's possible for readers to see all of that person's work. But I don't want all of those author tags to show up in the tag cloud. I'm hoping I can do that by making prepending each writer's name with "Author: ", so that we would end up with "Author: John Jones" and "Author: Liz Carmouche", and then somehow excluding all of the tags that start with "Author: ".
    – Jeremy
    Mar 3, 2015 at 19:14

1 Answer 1


You could achieve this with get_terms() and 'name__like' => 'Author:' argument. See linked documentation.

From architecture perspective, however, you probably shouldn't be (ab)using tags for this. It would make sense to split your authors into custom taxonomy. It would be more clear semantically, as well as easier to deal with in interface and code.

  • Ah. I played around a little with get_terms() and 'name__like' but didn't get quite there. In any case, if I'm going to go the route of a custom taxonomy, I'm guessing I could just crib from codex.wordpress.org/Taxonomies#Custom_Taxonomies, (replacing People with Writers and person with writer) and then display the writer on each post. Does that sound like the right approach?
    – Jeremy
    Mar 3, 2015 at 21:19
  • Yes, that sounds right on the mark. :)
    – Rarst
    Mar 3, 2015 at 21:44
  • Hmm. Wasn't 100% sure where to put my code. Guessed at putting it in the functions.php file in my theme's root directory. Either my code was wrong, or that was the wrong place or both. Had been getting nothing but a one-line error. Removed the code and now get a different set of errors. Code:
    – Jeremy
    Mar 6, 2015 at 2:58
  • Code: //Create a new taxonomy for writers function people_init() { // create a new taxonomy register_taxonomy( 'Writers', 'post', array( 'label' => __( 'Writers' ), 'rewrite' => array( 'slug' => 'writer' ), ) ) ); } add_action( 'init', 'people_init' ); Error: Use of undefined constant default_topic_count_text- assumed 'default_topic_count_text'
    – Jeremy
    Mar 6, 2015 at 3:06
  • That would be better suited as separate question or update to this one, comments aren't too good for discussing code.
    – Rarst
    Mar 6, 2015 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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