# Come aggiungere e rimuovere un Tag in un plugin

**URL:** https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632
**Category:** Development
**Tags:** tags
**Created:** [31 Gennaio 2024, 1:24pm UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632 "2024-01-31T13:24:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![omppatil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omppatil/32/359876_2.png) [@omppatil](https://meta.discourse.org/u/omppatil)
#### Post date: [31 Gennaio 2024, 1:24pm UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/1 "2024-01-31T13:24:33Z")

</div>

Ciao!  
Come possiamo aggiungere un tag a un post e anche rimuovere il tag del post utilizzando le funzioni di Discourse?

---

<div class="post-metadata">

### Author: ![twofoursixeight](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/twofoursixeight/32/574822_2.png) [@twofoursixeight](https://meta.discourse.org/u/twofoursixeight)
#### Post date: [1 Febbraio 2024, 3:07am UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/2 "2024-02-01T03:07:37Z")

</div>

Ciao. Usa questo per capire come utilizzare l’API di Discourse se non capisci come utilizzare l’API di Discourse e desideri imparare:

> [@Reverse engineer the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576?u=twofoursixeight):
>
> Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api. Many of the endpoints are properly documented in the [discourse\_api](https://github.com/discourse/discourse_api) gem, however some endpoints lack documentation. To determine how to do something with the JSON API here are some steps you can follow. Example: recategorize a topic. Go to a topic and start editing a category: Open Chrome dev tools, switch to the Network tab, select XHR filter: Perform the op…

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [1 Febbraio 2024, 3:15am UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/3 "2024-02-01T03:15:46Z")

</div>

Questo è in realtà un argomento duplicato. 👍  
Gli ho risposto qui: [How to add and remove a flag for a post in a plugin](https://meta.discourse.org/t/how-to-add-and-remove-a-flag-for-a-post/293630).

---

<div class="post-metadata">

### Author: ![omppatil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omppatil/32/359876_2.png) [@omppatil](https://meta.discourse.org/u/omppatil)
#### Post date: [1 Febbraio 2024, 4:53am UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/5 "2024-02-01T04:53:43Z")

</div>

In realtà, questo non è un argomento duplicato poiché ho posto un’altra domanda su “Flag” e questa domanda è correlata a “Tag”. Sto cercando di utilizzare le funzioni nello sviluppo di un plugin.

Poiché sto sviluppando un plugin e ho controllato tutte le risorse possibili, non ho trovato una funzione pertinente che mi aiuti ad **aggiungere e rimuovere un tag** per il post.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [1 Febbraio 2024, 7:13am UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/6 "2024-02-01T07:13:06Z")

</div>

Lo sviluppo non è il mio forte, ma spesso ci sono esempi su come fare le cose nei plugin esistenti. Penso che il plugin Automation abbia uno script per aggiungere tag basati sul triage dell’IA. Forse esaminarlo potrebbe essere utile?

In generale, consiglierei anche di includere maggiori dettagli su ciò che hai già provato/a che punto sei arrivato quando chiedi aiuto allo sviluppo. Questo può aiutare a fornire contesto per qualsiasi risposta che potresti sperare di ottenere.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [1 Febbraio 2024, 7:21am UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/7 "2024-02-01T07:21:46Z")

</div>

> [@omppatil](#):
>
> **aggiungi e rimuovi un tag** per il post.

Solo per precisare: non puoi taggare un post.

Puoi invece taggare un argomento.

Il che potrebbe spiegare perché non sei riuscito a trovare un esempio del primo.

Ecco un esempio del secondo:

> <https://github.com/merefield/discourse-ai-topic-summary/blob/090baaaf04bd4be91d90b8133b2108266ad2ef39/lib/summarise.rb#L39>

---

<div class="post-metadata">

### Author: ![omppatil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omppatil/32/359876_2.png) [@omppatil](https://meta.discourse.org/u/omppatil)
#### Post date: [2 Febbraio 2024, 10:41am UTC](https://meta.discourse.org/t/how-to-add-and-remove-a-tag-in-a-plugin/293632/8 "2024-02-02T10:41:43Z")

</div>

Esiste una funzione o una funzionalità che funziona allo stesso modo di un tag e che, facendo clic su di essa, elencherà tutti quei post?
