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

---

Buscar plugins

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

Este plugin **non se actualizou en máis de 2 anos**. É posible que xa non sexa compatible
ou mantido por ninguén, ou podes ter problemas de compatibilidade cando se usa con
novas versións de WordPress.

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

# Limit taxonomy term count

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

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

 * [Detalles](https://gl.wordpress.org/plugins/limit-taxonomy-term-count/#description)
 * [Valoracións](https://gl.wordpress.org/plugins/limit-taxonomy-term-count/#reviews)
 *  [Instalación](https://gl.wordpress.org/plugins/limit-taxonomy-term-count/#installation)
 * [Desenvolvemento](https://gl.wordpress.org/plugins/limit-taxonomy-term-count/#developers)

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

## Descrición

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);
    ```

## Instalación

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

## Preguntas frecuentes

  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;
    }
    ```

## Comentarios

![](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/) 20 de Xuño, 2019

Works as promised!

 [ Ler a 1 opinión ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/)

## Colaboradores e desenvolvedores

“Limit taxonomy term count” é un software de código aberto. As seguintes persoas
colaboraron con este plugin.

Colaboradores

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

[Traduce “Limit taxonomy term count” ao teu idioma.](https://translate.wordpress.org/projects/wp-plugins/limit-taxonomy-term-count)

### Interesado no desenvolvemento?

[Revisa o código](https://plugins.trac.wordpress.org/browser/limit-taxonomy-term-count/),
bota unha ollada ao[repositorio SVN](https://plugins.svn.wordpress.org/limit-taxonomy-term-count/),
ou subscríbete ao [log de desenvolvemento](https://plugins.trac.wordpress.org/log/limit-taxonomy-term-count/)
por [RSS](https://plugins.trac.wordpress.org/log/limit-taxonomy-term-count/?limit=100&mode=stop_on_copy&format=rss).

## Rexistro de cambios

#### 1.0

 * First version released.

## Meta

 *  Versión **1.0**
 *  Última actualización **Fai 8 anos**
 *  Instalacións activas **Menos de 10**
 *  Versión de WordPress ** 4.7 ou superior **
 *  Probado ata **4.9.31**
 *  Versión de PHP ** 5.6 ou superior **
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/limit-taxonomy-term-count/)
 * Etiqueta
 * [taxonomy](https://gl.wordpress.org/plugins/tags/taxonomy/)
 *  [Vista avanzada](https://gl.wordpress.org/plugins/limit-taxonomy-term-count/advanced/)

## Valoracións

 5 de 5 estrelas

 *  [  1 valoración de 5 estrelas     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=5)
 *  [  0 valoracións de 4 estrelas     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=4)
 *  [  0 valoracións de 3 estrelas     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=3)
 *  [  0 valoracións de 2 estrelas     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=2)
 *  [  0 valoracións de 1 estrelas     ](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/?filter=1)

[A túa valoración](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/#new-post)

[Ver todas as valoracións](https://wordpress.org/support/plugin/limit-taxonomy-term-count/reviews/)

## Colaboradores

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

## Soporte

Tes algo que dicir? Necesitas axuda?

 [Ver o foro de soporte](https://wordpress.org/support/plugin/limit-taxonomy-term-count/)