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:
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 -
unlisted
: Unlisted topics only -
deleted
: Deleted topics 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
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 (includesbumped_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
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.
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.
Plugin-specific parameters
Some plugins add additional query string parameters:
Solved plugin
If you have the Solved plugin installed:
-
?solved=yes
: Show solved topics -
?solved=no
: Show unsolved topics
Assign plugin
If you have the Assign 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:
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
Last edited by @hugh 2024-07-02T09:58:50Z
Last checked by @hugh 2024-07-02T09:58:55Z
Check document
Perform check on document: