# Using query strings to filter topic views

**URL:** https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224
**Category:** Using Discourse
**Tags:** how-to
**Created:** [December 8, 2022, 2:02am UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224 "2022-12-08T02:02:58Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [December 8, 2022, 2:02am UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/1 "2022-12-08T02:02:58Z")

</div>

> 🔖 This guide explains how to use query strings to get custom filtered topic views on any Discourse site. Query strings can be used by all users to view specific lists of topics, create custom links to unique topic lists, and search for topics meeting specific criteria.
> 
> 🙋 Required user level: All users

Query strings are text that you can append to the end of most Discourse URLs to get a custom, filtered view of topics. They can be useful for viewing specific lists of topics, creating custom links to unique topic lists, and searching for topics that meet specific criteria.

## Understanding query strings

A query string is added to the end of a URL, starting with a question mark (`?`), followed by parameters and their values. For example:

```plaintext
https://meta.discourse.org/?status=open

```

In this URL, `?status=open` is the query string.

The list of topics you see when using query strings will still be limited to the topics accessible by your user account. No settings need to be enabled to use query strings.

## Available query string parameters

Here are the query string parameters you can use on all Discourse sites:

### Status

Use `?status=_` to display topics with a specific status:

- `open`: Open topics only
- `closed`: Closed topics only
- `archived`: Archived topics only
- `listed`: Listed (visible) topics only
- `unlisted`: Unlisted topics only
- `deleted`: Deleted topics only
- `public`: Topics in public (non-read-restricted) categories only

### Search

Use `?search=_` to create a full page of search results. Replace `_` with your search terms.

### State

Use `?state=_` to display topics with a specific state:

- `muted`: Show topics you’ve muted
- `normal`: Show topics you have set to normal
- `tracking`: Show topics you’re tracking
- `watching`: Show topics you’re watching
- `watching_first_post`: Show topics in categories or with tags you’re watching first post for

### Ascending order

Use `?ascending=true` to show topics by date in ascending order. The default is descending order.

### Order

Use `?order=_` to display topics in descending order by various criteria:

- `likes`: By like count
- `op_likes`: By likes on the original post
- `views`: By views
- `posts`: By post count (replies)
- `activity`: By last activity date (includes `bumped_at` date)
- `posters`: By the number of participants
- `category`: By category name (Z-A)
- `created`: By topic creation date (newest topics first)

### Post count filters

- `?max_posts=_`: Returns topics with post counts of `_` or lower
- `?min_posts=_`: Returns topics with post counts of `_` or greater

### Age filters

- `?before=_`: Returns topics created more than `_` days ago
- `?bumped_before=_`: Returns topics last bumped more than `_` days ago

### Topic IDs

Use `?topic_ids=_` to display a list of topics with specific IDs. Accepts a comma-delimited string of topic IDs.

### Category

Use `?category=_` to display a list of topics for specific categories. Accepts a comma-delimited string of category ID numbers.

Use `?no_subcategories=true` to exclude topics from subcategories when filtering by category.

### Tags

Use `?tags=_` to filter topics by tags. For example, `https://meta.discourse.org/?tags=how-to` would show all topics with the #how-to tag.

Use `?match_all_tags=true` combined with `?tags=_` to require topics to have all of the specified tags (rather than any of them).

Use `?no_tags=true` to show only topics that have no tags.

Use `?exclude_tag=_` to exclude topics with a specific tag.

### Liked filter

Use `?f=liked` to show only topics where the current user has liked a post.

## Plugin-specific parameters

Some plugins add additional query string parameters:

### Solved plugin

If you have the [Solved](https://meta.discourse.org/t/discourse-solved/30155) plugin installed:

- `?solved=yes`: Show solved topics
- `?solved=no`: Show unsolved topics

### Assign plugin

If you have the [Assign](https://meta.discourse.org/t/discourse-assign/58044) plugin installed:

- `?assigned=username`: View all assigned topics for a specific user
- `?assigned=*`: View all assigned topics for all users
- `?assigned=me`: View all topics assigned to the current user
- `?assigned=nobody`: View all unassigned topics

## Combining query strings

You can combine multiple query strings using the ampersand (`&`) symbol. When using multiple query strings, only the first parameter needs the `?` symbol. For example:

```plaintext
https://meta.discourse.org/?max_posts=1&status=closed

```

This URL would show closed topics with only one post.

## Using the advanced search page

You can also use the advanced search page to build these URLs with a graphical user interface and then copy the resulting URL. Note that some search filters may not work as query string parameters outside of the search context.

## Additional resources

- [Topics list filter feature](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641)

> Last edited by @hugh 2024-07-02T09:58:50Z
> 
> Last checked by @hugh 2024-07-02T09:58:55Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 8, 2022, 11:00am UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/2 "2022-12-08T11:00:23Z")

</div>

Can’t you use the advanced search page to build these urls with the gui and then just copy the url?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 16, 2023, 9:21am UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/3 "2023-05-16T09:21:53Z")

</div>

It seems they are the same parameters (we just need to replace `:` from the search filter to `=` in the query string), but some search filter doesn’t work when used as a query string parameter outside search.

So I believe the full list is in this documentation. I’d be curious to see in which Discourse file they are referenced to be sure, though.

Edit : there is now a `/filter` route with way more filter criteria:

> [@Topics list filter feature](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641):
>
> We have recently introduced an innovative [/filter](https://meta.discourse.org/filter) route, enabling more sophisticated filtering of the topics list. Significantly, this marks the initial step towards a unified topic filtering language for both search and filtering. Additionally, the dedicated route for topic list filtering enhances the customizability of the sidebar, as users can now incorporate links as [custom section links](https://meta.discourse.org/t/custom-sidebar-sections-being-tested-on-meta/255303) within the sidebar. How it works The [/filter](https://meta.discourse.org/filter) has an input field which users can input a query string to …

---

<div class="post-metadata">

### Author: ![krystal](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@krystal](https://meta.discourse.org/u/krystal)
#### Post date: [February 1, 2024, 11:29pm UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/4 "2024-02-01T23:29:01Z")

</div>

If you have the Solved plugin, you can also use:

?solved=yes  
?solved=no

---

<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: [February 1, 2024, 11:52pm UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/5 "2024-02-01T23:52:30Z")

</div>

I think there are some for [Assign](https://meta.discourse.org/t/discourse-assign/58044) too:

> [@Discourse Assign](https://meta.discourse.org/t/discourse-assign/58044/1):
>
> - `https://sitename.com/latest?assigned=username` to view all assigned topics for a user
> - `https://sitename.com/latest?assigned=*` to view all assigned topics for all users
> - `https://sitename.com/latest?assigned=me` to view all assigned to current user
> - `https://sitename.com/latest?assigned=nobody` to view all unassigned

I’ll add them in. 👍

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [February 3, 2024, 2:19am UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/6 "2024-02-03T02:19:05Z")

</div>

At a guess imagine you could also use this for Tags?

Awesome how to

---

<div class="post-metadata">

### Author: ![SaraDev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saradev/32/335139_2.png) [@SaraDev](https://meta.discourse.org/u/SaraDev)
#### Post date: [February 5, 2024, 8:47pm UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/7 "2024-02-05T20:47:14Z")

</div>

> [@Heliosurge](#):
>
> At a guess imagine you could also use this for Tags?

Yes, you can append `?tags=_` to Discourse URLs use query strings to filter for tags.

For example, `https://meta.discourse.org/?tags=how-to` would direct you to all of the #how-to tags on Meta.

---

<div class="post-metadata">

### Author: ![haoadoreorange](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haoadoreorange/32/471429_2.png) [@haoadoreorange](https://meta.discourse.org/u/haoadoreorange)
#### Post date: [December 6, 2024, 10:25pm UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/8 "2024-12-06T22:25:00Z")

</div>

Is is possible to have a negative (exclude) filter using query string ? Currently with the advanced search it is done by prefix with a -

`-tags: smth` but this is not possible with query string.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 6, 2024, 10:30pm UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/9 "2024-12-06T22:30:31Z")

</div>

It is definitely possible by using the new /filter route.

> [@Topics list filter feature](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641):
>
> We have recently introduced an innovative [/filter](https://meta.discourse.org/filter) route, enabling more sophisticated filtering of the topics list. Significantly, this marks the initial step towards a unified topic filtering language for both search and filtering. Additionally, the dedicated route for topic list filtering enhances the customizability of the sidebar, as users can now incorporate links as [custom section links](https://meta.discourse.org/t/custom-sidebar-sections-being-tested-on-meta/255303) within the sidebar. How it works The [/filter](https://meta.discourse.org/filter) has an input field which users can input a query string to …

For example [https://meta.discourse.org/filter?q=-tags%3Aofficial%20%20category%3Aplugin](https://meta.discourse.org/filter?q=-tags%3Aofficial%20%20category%3Aplugin)

---

<div class="post-metadata">

### Author: ![haoadoreorange](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haoadoreorange/32/471429_2.png) [@haoadoreorange](https://meta.discourse.org/u/haoadoreorange)
#### Post date: [December 12, 2024, 3:26pm UTC](https://meta.discourse.org/t/using-query-strings-to-filter-topic-views/248224/10 "2024-12-12T15:26:32Z")

</div>

Tks ! How about search with multiple status (OR) ? I tried different way of searching but it seems that’s not supported at all. For example I have some topics that are either open, closed or archived, I just want to filter out the archived, aka search for open OR closed. So far I tried

- Advanced search: status:open,closed
- Advanced search: status:open status:closed
- Query string: ?status=open,closed

None of them works.
