# Create topic if not found

**URL:** https://meta.discourse.org/t/create-topic-if-not-found/349365
**Category:** Support
**Created:** [January 28, 2025, 12:30pm UTC](https://meta.discourse.org/t/create-topic-if-not-found/349365 "2025-01-28T12:30:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![xian](https://avatars.discourse-cdn.com/v4/letter/x/71e660/32.png) [@xian](https://meta.discourse.org/u/xian)
#### Post date: [January 28, 2025, 12:30pm UTC](https://meta.discourse.org/t/create-topic-if-not-found/349365/1 "2025-01-28T12:30:00Z")

</div>

Hello,  
I’m new to this forum and looking for help.  
I could not find a solution to my specific problem.

I want to be able to add a topic / thread in discourse with a press of a button if it is not found by the search. The name of the topic should be the search term.

Is there something like this already or how would I do that?

Thanks for any help

---

<div class="post-metadata">

### Author: ![tvavrda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tvavrda/32/480674_2.png) [@tvavrda](https://meta.discourse.org/u/tvavrda)
#### Post date: [January 28, 2025, 12:43pm UTC](https://meta.discourse.org/t/create-topic-if-not-found/349365/2 "2025-01-28T12:43:50Z")

</div>

I thought about that too in order to make something Wikipedia has. So I [asked](https://ask.discourse.com) and it seems to me there would be a way, maybe with a little theme that would convert the links leading nowhere to that:

Discourse allows you to create a topic dynamically by constructing a specific URL with parameters. However, it does not directly create topics by clicking on arbitrary non-existing links, unless incorporated via a custom system like the embedded comments setup. Here’s how dynamic topic creation via URL works:

### Constructing the URL for Topic Creation

1. **Basic new topic URL:**  
Add `/new-topic` to your site’s URL:

```plaintext
https://your-discourse-instance.com/new-topic

```

Clicking this will open a blank new topic composer for logged-in users. Non-logged-in users will be prompted to log in before composing.  
2. **Pre-fill topic fields with parameters:**  
To include predefined information such as title, body, category, or tags, use additional query parameters:

```plaintext
https://your-discourse-instance.com/new-topic?title=Topic%20Title&body=Topic%20Body&category=category/subcategory&tags=tag1,tag2

```

- `title`: The topic title (URL-encoded, e.g., spaces replaced by `%20`).
- `body`: Content of the topic.
- `category`: Specify the category and optional subcategory using `/`.
- `tags`: Comma-separated list of tags.

1. **Optional parameter for category ID:**  
Instead of the category name, you can use the numeric `category_id`. For instance:

```plaintext
https://your-discourse-instance.com/new-topic?title=Topic%20Title&category_id=5

```

1. **Encoding special characters:**  
Ensure all added text parameters are URL-encoded to avoid errors. Tools like the [w3Schools URL Encode Decoder](https://www.w3schools.com/tags/ref_urlencode.asp) can help.

### Example

To pre-fill a topic for discussing a WordPress issue:

```plaintext
https://meta.discourse.org/new-topic?title=WordPress%20Issue&body=Please%20describe%20your%20issue...&category=support/wordpress&tags=wordpress

```

### Additional Notes:

- This approach works only for logged-in users. Non-logged-in users will need to sign in first.
- Testing links beforehand is advisable to ensure all parameters function as expected.

If you’re looking for a completely automated dynamic linking solution (similar to embedded comments or a Wikipedia-style red link setup), that would require custom development or integration.
