> 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`). > - 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: queryTags(options: QueryTagsOptions) # Method package: wixBlogBackend # Method menu location: wixBlogBackend --> tags --> queryTags # Method Link: https://dev.wix.com/docs/velo/apis/wix-blog-backend/tags/query-tags.md # Method Description: Creates a query to retrieve a list of tags. The `queryTags()` function builds a query to retrieve a list of up to 4,000 tags per language, and returns a [`TagsQueryBuilder`](https://www.wix.com/velo/reference/wix-blog-backend/tags/tagsquerybuilder) object. The returned object contains the query definition, which is typically used to run the query using the [`find()`](https://www.wix.com/velo/reference/wix-blog-backend/tags/tagsquerybuilder/find) function. You can refine the query by chaining `TagsQueryBuilder` functions onto the query. `TagsQueryBuilder` functions enable you to sort, filter, and control the results that `queryTags()` returns. `queryTags()` runs with these `TagsQueryBuilder` defaults that can be overridden: - [`limit(50)`](https://www.wix.com/velo/reference/wix-blog-backend/tags/tagsquerybuilder/limit) - [`ascending('_id')`](https://www.wix.com/velo/reference/wix-blog-backend/tags/tagsquerybuilder/ascending) The following `TagQueryBuilder` functions are supported for `queryTags()`. For a full description of the Tags object, see the object returned for the [`items`](https://www.wix.com/velo/reference/wix-blog-backend/tags/tagsqueryresult/items) property in [`TagsQueryResult`](https://www.wix.com/velo/reference/wix-blog-backend/tags/tagsqueryresult). |PROPERTY |SUPPORTED FILTERS & SORTING |:---:|:---:| |`_id`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`in()`](/tags-query-builder/in)| |`label`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`startsWith()`](/tags-query-builder/starts-with),[`hasSome()`](/tags-query-builder/has-some),[`exists()`](/tags-query-builder/exists),[`in()`](/tags-query-builder/in),[`ascending()`](/tags-query-builder/ascending),[`descending()`](/tags-query-builder/descending)| |`slug`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`startsWith()`](/tags-query-builder/starts-with),[`hasSome()`](/tags-query-builder/has-some),[`exists()`](/tags-query-builder/exists),[`in()`](/tags-query-builder/in),[`ascending()`](/tags-query-builder/ascending),[`descending()`](/tags-query-builder/descending)| |`postCount`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`lt()`](/tags-query-builder/lt),[`le()`](/tags-query-builder/le),[`gt()`](/tags-query-builder/gt),[`ge()`](/tags-query-builder/ge),[`in()`](/tags-query-builder/in),[`ascending()`](/tags-query-builder/ascending),[`descending()`](/tags-query-builder/descending)| |`publishedPostCount`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`lt()`](/tags-query-builder/lt),[`le()`](/tags-query-builder/le),[`gt()`](/tags-query-builder/gt),[`ge()`](/tags-query-builder/ge),[`in()`](/tags-query-builder/in),[`ascending()`](/tags-query-builder/ascending),[`descending()`](/tags-query-builder/descending)| |`translationId`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`exists()`](/tags-query-builder/exists),[`in()`](/tags-query-builder/in)| |`language`|[`eq()`](/tags-query-builder/eq),[`ne()`](/tags-query-builder/ne),[`exists()`](/tags-query-builder/exists),[`in()`](/tags-query-builder/in),[`ascending()`](/tags-query-builder/ascending),[`descending()`](/tags-query-builder/descending)| # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Retrieves a list of all tags ```javascript import { tags } from 'wix-blog-backend'; export async function queryTagsFunction() { try { const queryTagsResults = await tags.queryTags().find(); const items = queryTagsResults.items; const firstItem = items[0]; const pageSize = queryTagsResults.pageSize; const hasNext = queryTagsResults.hasNext(); const hasPrev = queryTagsResults.hasPrev(); const length = queryTagsResults.length; const query = queryTagsResults.query; return items; } catch (error) { console.error(error); } } /* Returns: * [ * { * "_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": "" * }, * { * "_createdDate": "2022-07-21T14:52:58.099Z", * "_id": "6a67d2ea-b758-49f1-a2bd-cce214246809", * "_updatedDate": "2022-07-21T14:52:58.099Z", * "label": "your tag", * "language": "en", * "postCount": 2, * "publishedPostCount": 2, * "slug": "your-tag", * "translationId": "" * } * { * "_createdDate": "2022-07-22T09:27:45.883Z", * "_id": "28230621-702d-4dab-af68-7a2a9b152fae", * "_updatedDate": "2022-07-22T09:27:45.883Z", * "label": "their tag", * "language": "en", * "postCount": 3, * "publishedPostCount": 3, * "slug": "their-tag", * "translationId": "" * }, * ] */ ``` ## Retrieves a list of all tags (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { tags } from 'wix-blog-backend'; export const queryTagsFunction = webMethod(Permissions.Anyone, async () => { try { const queryTagsResults = await tags.queryTags().find(); const items = queryTagsResults.items; const firstItem = items[0]; const pageSize = queryTagsResults.pageSize; const hasNext = queryTagsResults.hasNext(); const hasPrev = queryTagsResults.hasPrev(); const length = queryTagsResults.length; const query = queryTagsResults.query; return items; } catch (error) { console.error(error); } }); /* Returns: * [ * { * "_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": "" * }, * { * "_createdDate": "2022-07-21T14:52:58.099Z", * "_id": "6a67d2ea-b758-49f1-a2bd-cce214246809", * "_updatedDate": "2022-07-21T14:52:58.099Z", * "label": "your tag", * "language": "en", * "postCount": 2, * "publishedPostCount": 2, * "slug": "your-tag", * "translationId": "" * } * { * "_createdDate": "2022-07-22T09:27:45.883Z", * "_id": "28230621-702d-4dab-af68-7a2a9b152fae", * "_updatedDate": "2022-07-22T09:27:45.883Z", * "label": "their tag", * "language": "en", * "postCount": 3, * "publishedPostCount": 3, * "slug": "their-tag", * "translationId": "" * }, * ] */ ``` ## Query for tags with filters. ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { tags } from 'wix-blog-backend'; /* Sample options values: * { * fieldsets: [ * 'URL' * ] * } */ export const queryTagsFunction = webMethod(Permissions.Anyone, async () => { try { const queryTagsResults = await tags.queryTags() .lt('postCount', 3) .find(); const items = queryTagsResults.items; const firstItem = items[0]; const pageSize = queryTagsResults.pageSize; const hasNext = queryTagsResults.hasNext(); const hasPrev = queryTagsResults.hasPrev(); const length = queryTagsResults.length; const query = queryTagsResults.query; return items; } catch (error) { console.error(error); } }); /* Returns: * [ * { * "_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": "", * "url": "http://https://tadasz7.wixsite.com/blog-velo-events/my-blog/tags/my-tag" * }, * { * "_createdDate": "2022-07-21T14:52:58.099Z", * "_id": "6a67d2ea-b758-49f1-a2bd-cce214246809", * "_updatedDate": "2022-07-21T14:52:58.099Z", * "label": "your tag", * "language": "en", * "postCount": 2, * "publishedPostCount": 2, * "slug": "your-tag", * "translationId": "", * "url": "http://https://tadasz7.wixsite.com/blog-velo-events/my-blog/tags/your-tag" * } * ] */ ``` ---