I'm wondering if you can help me work through an issue or provide alt ideas.

I have an archive displaying a list of custom tax terms in a grid view.

My client needs to be able to turn on/off the terms from displaying in the grid. If these were posts this would be easy because I could simply have him check/uncheck a category for the post. However, taxonomies don't have that feature out of the box.

Does anyone know how I might accomplish this?

3 Answers 3


You might be able to accomplish this using Advanced Custom Fields: http://www.advancedcustomfields.com/resources/taxonomy/

Field groups, like the taxonomy field, can be assigned to templates. Editing the taxonomy archive page, the user would see checkboxes (or radio buttons, or a select menu) for the taxonomy terms.

In the corresponding "taxonomy archive" template (from link above)...


$terms = get_field('taxonomy_field_name');

if( $terms ): ?>


    <?php foreach( $terms as $term ): ?>

        <a href="<?php echo get_term_link( $term ); ?>"><?php echo $term->name; ?></a>

    <?php endforeach; ?>


<?php endif; ?>
  • Make sure to provide some context for links, @taruckus. See: wordpress.stackexchange.com/help/how-to-answer "Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there." I know why you're recommending this, but it's not clear from the answer.
    – mrwweb
    Commented Aug 18, 2014 at 21:49
  • Thank you, I will look at ACF. Could you provide any more info about how it may help?
    – streetfire
    Commented Aug 18, 2014 at 22:21
  • Sure all; post expanded.
    – Taruc
    Commented Aug 18, 2014 at 22:53
  • Hi, just an update, ACF has helped me achieve this. You code above I think would work, but I needed something a little more specific, please see the answer I added.
    – streetfire
    Commented Aug 26, 2014 at 17:56


From what I understand you want a filter to display posts that belong to a specific list of terms. As default you display all posts making all terms enabled. In order to disable a term from being displayed you need to exclude it from the loop.

// we get all the terms of the taxonomy
$terms = get_terms('mytaxonomy');

as a GET parameter created by the exclude form
$excludeList = array();

if (isset($_GET['excludeTerms']) && !empty($_GET['excludeTerms'])) {
    $excludeList = explode(',', $_GET['excludeTerms']);

how to display the available terms
the permalink is get_term_link($term, $taxonomy);
$termList = '';
if (!empty($terms) && !is_wp_error($terms)) {
    echo "<ul>";
    foreach ($terms as $term) {
        if (!in_array($term->name, $excludeList)) {
            echo "<li class='enabled-term'>" . $term->name . "</li>";
            if ($termList == '') {
                $termList = $term->name;
            } else {
                $termList .= ', ' . $term->name;
        } else {
            echo "<li class='disabled-term'>" . $term->name . "</li>";
    echo "</ul>";

if ($termList != '') {
    $args = array(
        'post_type' => 'posttype',
        'mytaxonomy' => $termList
} else {
    $args = array(
        'post_type' => 'posttype'
while (have_posts()) {
    echo "<br />";
        .enabled-term, .disabled-term {
            cursor: pointer;

        .disabled-term {
            color: #ddd;
        jQuery(document).ready(function ($) {
            $('.enabled-term').live('click', function () {
                // so that one term remains enabled
                if ($('.enabled-term').length == 1)
            $('.disabled-term').live('click', function () {
            function navigate() {
                list = $('.disabled-term');
                excludeList = '';
                for (i = 0; i < list.length; i++) {
                    if (excludeList == '')
                        excludeList = $(list[i]).text();
                        excludeList += ',' + $(list[i]).text();
                window.location = window.location.origin + 
                                  window.location.pathname + 
                                  '?excludeTerms=' + excludeList;

http://codex.wordpress.org/Function_Reference/get_terms for term list http://codex.wordpress.org/query_posts for the loop (Example 5 for tax & terms)

Hope this helps.

  • Hi, Thank you for your answer, but this is not what I was looking for.
    – streetfire
    Commented Aug 26, 2014 at 17:55
  • Take it as an idea not a solution. It may lead you somewhere.
    – aifrim
    Commented Sep 1, 2014 at 16:49
  • @streetfire you are talking about a back-end solution?
    – aifrim
    Commented Sep 3, 2014 at 14:28
  • yes a backend solution was what I needed. I was able to achieve it using Advanced Custom fields and a custom query.
    – streetfire
    Commented Sep 3, 2014 at 14:48

I have found a solution. Thanks to @Tarukus as his answer was helpful. Again, my goal was to display terms (not posts) from my custom taxonomy via an on/off switch. To do this, I used Advanced Custom Fields and created a "Select" field with two values (on/off). Once this field was applied to my taxonomy I could select a value for each term. The default value was set to "off". Now to display only the terms set to "on" I had to add the following code in my template file - and of course set some terms to "on".


    $terms = get_terms('MYTAXONOMY', array());      



        echo '<ul>';

        foreach($terms as $term)


            if( get_field('ENTERCUSTOMFIELDSLUG', 'ENTERMYTAXONOMY_'.$term->term_id) != 'ENTERFIELDVALUE' ) 

            echo '<li>' . $term->name . '</a></li>';


        echo '</ul>';


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.