# How do i add/remove tags from a component in code?

**URL:** <https://forums.unrealengine.com/t/how-do-i-add-remove-tags-from-a-component-in-code/313946>\
**Category:** C++\
**Tags:** tags, unreal-engine, CPP, question\
**Created:** [April 5, 2015, 7:13pm UTC](https://forums.unrealengine.com/t/how-do-i-add-remove-tags-from-a-component-in-code/313946 "2015-04-05T19:13:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Problemahtic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Problemahtic](https://forums.unrealengine.com/u/Problemahtic)\
**Post date:** [April 5, 2015, 7:13pm UTC](https://forums.unrealengine.com/t/how-do-i-add-remove-tags-from-a-component-in-code/313946/1 "2015-04-05T19:13:45Z")

</div>

i would like to know how to add or remove tags in code (mainly add). I know how to check for a components tag but i need to know how to add one in c++.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_957a4452](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_957a4452](https://forums.unrealengine.com/u/anonymous_user_957a4452)\
**Post date:** [April 6, 2015, 7:12am UTC](https://forums.unrealengine.com/t/how-do-i-add-remove-tags-from-a-component-in-code/313946/2 "2015-04-06T07:12:51Z")

</div>

Hi ,

Every ActorComponent has field ComponentsTags. It is TArray, so you can add/remove tags like this

```
pActorComponent->ComponentTags.Add(FName("NewTag"));
pActorComponent->ComponentTags.Remove(FName("OldTag"));

```

Hope it helps!

---

<div class="post-metadata">

**Author:** ![Prakash1996](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Prakash1996](https://forums.unrealengine.com/u/Prakash1996)\
**Post date:** [December 9, 2023, 2:31pm UTC](https://forums.unrealengine.com/t/how-do-i-add-remove-tags-from-a-component-in-code/313946/3 "2023-12-09T14:31:10Z")

</div>

is there a way to do it with blueprints?

---

<div class="post-metadata">

**Author:** ![dragonflyy69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dragonflyy69](https://forums.unrealengine.com/u/dragonflyy69)\
**Post date:** [April 8, 2024, 4:22am UTC](https://forums.unrealengine.com/t/how-do-i-add-remove-tags-from-a-component-in-code/313946/4 "2024-04-08T04:22:49Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/6/1c6d7d2f2df462e3910ca44b4ad57de4276b8f0a.png)  
The object in the screenshot is a Static Mesh component, you can add/get tags in blueprints this way.
