How to show only terms by id or slug on edit-tags.php (custom taxonomy manage page) for a custom taxonomy

How can I show only terms by id or slug on edit-tags.php (custom taxonomy manage page) for a custom taxonomy.

I am saving term_owner metadata to a table for each term and getting all terms’ ids for a specific term_owner. Now I want to show only these terms on edit-tags.php.

Read More

I have tried list_terms_exclusions filter but seems it doses not work for edit-tags.php?taxonomy={custom_taxonomy_name} or I am missing something.

Can anyone help me with a working example?

Thanks you.

Related posts

Leave a Reply

2 comments

  1. The edit-tags.php doesn’t listen to any arguments except the s search query variable. If you want to do anything more advanced, you will have to hook into the get_terms filter.

  2. I have added these code to my theme function.php for my custom taxonomy “series”.

    
    add_filter('edited_terms', 'mysite_edited_terms');
    function mysite_edited_terms($term_id) {
      if($_POST['taxonomy'] == 'series'): {
        $user = wp_get_current_user();
        if ($user->ID) {
          $terms = get_user_meta($user->ID,'users_terms_for_series');
          $terms = (empty($terms) ? $term_id : "{$terms},{$term_id}");
          update_user_meta($user->ID,'users_terms_for_series',$terms);
        }
      }
    }
    
    
    add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2);
    function my_list_terms_exclusions( $exclusions, $args ) {
      global $pagenow;
      if (current_user_can('can_manage_all_terms') && 
        $pagenow=='edit-tags.php?taxonomy=series') {
        $terms = get_user_meta($user->ID,'users_terms_for_series');
        $exclusions = " {$exclusions} AND t.ID NOT IN ({$terms})";
      }
      return $exclusions;
    }
    
    

    but nothing happened. This code is based on @MikeSchinkel. I think @Jan Fabry is right that the edit-tags.php doesn’t listen to any arguments. But I dont no how to do that.

    Any help will be greatly appreciated. Thanks.