# Tags in front matter doesn't update metadata cache

**URL:** <https://forum.obsidian.md/t/tags-in-front-matter-doesnt-update-metadata-cache/67394>\
**Category:** Bug graveyard\
**Tags:** tracked\
**Created:** [September 15, 2023, 10:04am UTC](https://forum.obsidian.md/t/tags-in-front-matter-doesnt-update-metadata-cache/67394 "2023-09-15T10:04:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelszo](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/b782af/32.png) [@kelszo](https://forum.obsidian.md/u/kelszo)\
**Post date:** [September 15, 2023, 10:04am UTC](https://forum.obsidian.md/t/tags-in-front-matter-doesnt-update-metadata-cache/67394/1 "2023-09-15T10:04:23Z")

</div>

### Steps to reproduce

1. Create a plugin with this code:

```auto
    plugin.registerEvent(
        plugin.app.metadataCache.on("changed", (path, data, cache) => {
            console.log("changed");
        }),
    );

```

1. Add `#test` to the body of a note. The metadata is updated.
2. Add `test` to the tags in the front matter. The metadata is not updated.

### Expected result

The metadata cache is updated with the tags in the front matter.

### Actual result

The metadata is not updated with the tags in the front matter.

### Environment

SYSTEM INFO:  
Obsidian version: v1.4.12  
Installer version: v1.4.11  
Operating system: #1-NixOS SMP PREEMPT\_DYNAMIC Wed Sep 6 20:22:26 UTC 2023 6.5.2

---

<div class="post-metadata">

**Author:** ![liam](https://forum.obsidian.md/user_avatar/forum.obsidian.md/liam/32/3070_2.png) [@liam](https://forum.obsidian.md/u/liam)\
**Post date:** [September 17, 2023, 3:13am UTC](https://forum.obsidian.md/t/tags-in-front-matter-doesnt-update-metadata-cache/67394/3 "2023-09-17T03:13:46Z")

</div>

I’m not able to reproduce the issue. I see the event fired and the console.log appears. How are you adding a tag to the frontmatter? In source mode or in live preview?

---

<div class="post-metadata">

**Author:** ![kelszo](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/b782af/32.png) [@kelszo](https://forum.obsidian.md/u/kelszo)\
**Post date:** [September 18, 2023, 9:00am UTC](https://forum.obsidian.md/t/tags-in-front-matter-doesnt-update-metadata-cache/67394/4 "2023-09-18T09:00:51Z")

</div>

Sorry, this was due to a discrepancy in the API. Tags in the body are stored in .tags (prefixed with a #), tags in frontmatter are stored i frontmatter.tags (without a #). My bad.

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [September 25, 2023, 9:01am UTC](https://forum.obsidian.md/t/tags-in-front-matter-doesnt-update-metadata-cache/67394/5 "2023-09-25T09:01:26Z")

</div>

Closed on September 25, 2023, 9:01am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
