Title: Limit taxonomy term count
Author: dahousecatz
Published: <strong>October 23, 2018</strong>
Last modified: October 23, 2018

---

Search plugins

![](https://ps.w.org/limit-taxonomy-term-count/assets/banner-772x250.png?rev=1961327)

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/limit-taxonomy-term-count/assets/icon-256x256.png?rev=1961327)

# Limit taxonomy term count

 By [dahousecatz](https://profiles.wordpress.org/dahousecatz/)

[Download](https://downloads.wordpress.org/plugin/limit-taxonomy-term-count.1.1.zip)

 * [Details](https://wordpress.org/plugins/limit-taxonomy-term-count/#description)
 * [Reviews](https://wordpress.org/plugins/limit-taxonomy-term-count/#reviews)
 *  [Installation](https://wordpress.org/plugins/limit-taxonomy-term-count/#installation)
 * [Development](https://wordpress.org/plugins/limit-taxonomy-term-count/#developers)

 [Support](https://wordpress.org/support/plugin/limit-taxonomy-term-count/)

## Description

By default WordPress does not allow you to limit how many taxonomy terms can be 
attached to a post.
 Enabling this plugin allows the use of the “limit” attribute
when initially calling register_taxonomy(). If the limit is set to 1 then only one
term can be added to the post. If the limit is greater than one then that many terms
may be added to the post. If the limit is attribute is not set, or it’s set to -
1 this plugin has no effect.

Example code showing the use of the limit attribute:

    ```
    register_taxonomy('artists', 'art_work', [
        'label'             => 'Artists',
        'show_ui'           => true,
        'limit'             => 1,
    ]);
    ```

This example shows the use of a custom taxonomy called “artists” and the post type
is “art_work”.

Here is another example but this time it’s editing the previously registered taxonomy“
post_tag”:

    ```
    // First load the taxonomy
    $taxonomy = get_taxonomy('post_tag');

    // Edit it to only allow 2 tags to be added per post
    $taxonomy->limit = 2;

    // Re-save it with our updated settings (note casting the object to an array before saving)
    register_taxonomy('post_tag', 'post', (array)$taxonomy);
    ```

## Installation

The easiest way to install this plugin is to go to Add New in the Plugins section
of your blog admin and search for
 “Limit taxonomy term count.” On the far right
side of the search results, click “Install.”

If the automatic process above fails, follow these simple steps to do a manual install:

 1. Extract the contents of the zip file into your `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress

## FAQ

  Can I edit settings passed to select2?

Yes, you can use the filter limit_taxonomy_term_count_js_data to make any changes
to settings.

E.g.

    ```
    add_filter('limit_taxonomy_term_count_js_data', 'my_plugin_limit_taxonomy_term_count_js_data');
    function my_plugin_limit_taxonomy_term_count_js_data($data) {
        foreach($data as $taxonomy_name => &$settings) {
            if($taxonomy_name == 'this_is_the_taxonomy_your_looking_for') {
                // This is the array of settings passed to select2:
                print_r($settings['select2_options']);
            }
        }
        return $data;
    }
    ```

## Reviews

![](https://secure.gravatar.com/avatar/99777a686bd48efac510ae5fdc6f51d68f190c372bff420f46465b7473c17f51?
s=60&d=retro&r=g)

### 󠀁[Works!](https://wordpress.org/support/topic/works-1584/)󠁿

 [Heli A.](https://profiles.wordpress.org/heli-a/) June 20, 2019

Works as promised!

 [ Read all 1 review ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/)

## Contributors & Developers

“Limit taxonomy term count” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ dahousecatz ](https://profiles.wordpress.org/dahousecatz/)

[Translate “Limit taxonomy term count” into your language.](https://translate.wordpress.org/projects/wp-plugins/limit-taxonomy-term-count)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/limit-taxonomy-term-count/),
check out the [SVN repository](https://plugins.svn.wordpress.org/limit-taxonomy-term-count/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/limit-taxonomy-term-count/)
by [RSS](https://plugins.trac.wordpress.org/log/limit-taxonomy-term-count/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.0

 * First version released.

## Meta

 *  Version **1.0**
 *  Last updated **8 years ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 4.7 or higher **
 *  Tested up to **4.9.29**
 *  PHP version ** 5.6 or higher **
 * Tag
 * [taxonomy](https://wordpress.org/plugins/tags/taxonomy/)
 *  [Advanced View](https://wordpress.org/plugins/limit-taxonomy-term-count/advanced/)

## Ratings

 5 out of 5 stars.

 *  [  1 5-star review     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/)

## Contributors

 *   [ dahousecatz ](https://profiles.wordpress.org/dahousecatz/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/limit-taxonomy-term-count/)