> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: getTagByLabel(label: string, options: GetTagByLabelOptions)

# Method package: wixBlogBackend

# Method menu location: wixBlogBackend --> tags --> getTagByLabel

# Method Link: https://dev.wix.com/docs/velo/apis/wix-blog-backend/tags/get-tag-by-label.md

# Method Description:

Gets a tag by the specified label.

The `getTagByLabel()` function returns a Promise that resolves to a tag whose label matches the specified label.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Get a tag by its label

```javascript
import { tags } from 'wix-blog-backend';

/* Sample label value:
 * 'my tag'
 */

export async function getTagByLabelFunction(tagId) {
  try {
    const result = await tags.getTagByLabel(tagId);
    const label = result.tag.label;
    const postCount = result.tag.postCount;
    console.log('Retrieved result:', result);
    return result;
  } catch (error) {
    console.error(error);
  };
}


/* Promise resolves to:
 * {
 *   "tag": {
 *     "_createdDate": "2022-07-19T10:30:03.607Z",
 *     "_id": "32970480-e53b-46e7-b52f-fba810a0b45d",
 *     "_updatedDate": "2022-07-19T10:30:03.607Z",
 *     "label": "my tag",
 *     "language": "en",
 *     "postCount": 1,
 *     "publishedPostCount": 1,
 *     "slug": "my-tag",
 *     "translationId": ""
 *   }
 * }
 */
```

## Get a tag by its label (export from backend code)

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { tags } from 'wix-blog-backend';

/* Sample label value:
 * 'my tag'
 */

export const getTagByLabelFunction = webMethod(Permissions.Anyone, async (tagId) => {
  try {
    const result = await tags.getTagByLabel(tagId);
    const label = result.tag.label;
    const postCount = result.tag.postCount;
    console.log('Retrieved result:', result);
    return result;
  } catch (error) {
    console.error(error);
  };
});


/* Promise resolves to:
 * {
 *   "tag": {
 *     "_createdDate": "2022-07-19T10:30:03.607Z",
 *     "_id": "32970480-e53b-46e7-b52f-fba810a0b45d",
 *     "_updatedDate": "2022-07-19T10:30:03.607Z",
 *     "label": "my tag",
 *     "language": "en",
 *     "postCount": 1,
 *     "publishedPostCount": 1,
 *     "slug": "my-tag",
 *     "translationId": ""
 *   }
 * }
 */

```

## Get a tag by its label with additional fields 

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { tags } from 'wix-blog-backend';

/* Sample label value:
 * 'my tag'
 * Sample options value:
 * {
 *   fieldsets:
 *   [
 *     'URL'
 *   ]
 * }
 */

export const getTagByLabelFunction = webMethod(Permissions.Anyone, async (tagId, options) => {
  try {
    const result = await tags.getTagByLabel(tagId, options);
    const label = result.tag.label;
    const postCount = result.tag.postCount;
    const url = result.tag.url;
    console.log('Retrieved result:', result);
    return result;
  } catch (error) {
    console.error(error);
  }
});

/* Promise resolves to:
 * {
 *   "tag": {
 *     "_createdDate": "2022-07-19T10:30:03.607Z",
 *     "_id": "32970480-e53b-46e7-b52f-fba810a0b45d",
 *     "label": "my tag",
 *     "slug": "my-tag",
 *     "_updatedDate": "2022-07-19T10:30:03.607Z",
 *     "postCount": 1,
 *     "publishedPostCount": 1,
 *     "language": "en",
 *     "translationId": "",
 *     "url": "http://https://tadasz7.wixsite.com/blog-velo-events/my-blog/tags/my-tag"
 *   }
 * }
 */
```

---