<p>Seems like a good case for a <a href="https://pluginfactory.io" rel="nofollow noreferrer">simple plugin</a> that listened to the <a href="https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry" rel="nofollow noreferrer"><code>onBeforeSaveEntry</code></a> event.</p>

<p>That plugin could verify the entry is in the section you're looking for, compare the existing slug against any saved in the database and do whatever you want to do from there (set it null, etc.).</p>

CC BY-SA 3.0
2017-05-11T14:42:36.593Z
Thank you, I've created a simple plugin that writes the slug always new when an entry is saved. Works perfect.
MISC
CC BY-SA 3.0
2017-05-09T17:46:29.110Z
2017-05-09T17:46:29.110Z
Brad Bell
<p>I have a channel, where entries do NOT have their own URLs. But a slug is created automatically every time I save an entry. And I have auto-generated titles.</p>

<p>Often I save an existing entry as a new entry and just change something which changes then my auto-generated titles also. But the slug does not change (only a number is added).</p>

<p>Now my problem: The search function also searches the slug what then results in wrong search results.</p>

<p>My question: The only solution I've found is to manually delete the existing slug and to save the entry again. Is the a better solution for my problem?</p>

<p>Thank you very much for your help!</p>

CC BY-SA 3.0
2017-05-09T16:07:10.540Z
Have you tried to change the search term options and to exclude (only include other attributes) the slug? https://craftcms.com/docs/config-settings#defaultSearchTermOptions

This way you don't have to work around the search.
Max Strebel
CC BY-SA 3.0
2017-05-11T08:32:26.103Z
Thank you. But this would only work in the front-end, but not in the back-end.
MISC
<slug><entry-slug>
How to change the Slug in case of copied entries?
# How to change the Slug in case of copied entries?

(Asked by: username_0 on 2017-05-09)

I have a channel, where entries do NOT have their own URLs. But a slug is created automatically every time I save an entry. And I have auto-generated titles.

Often I save an existing entry as a new entry and just change something which changes then my auto-generated titles also. But the slug does not change (only a number is added).

Now my problem: The search function also searches the slug what then results in wrong search results.

My question: The only solution I've found is to manually delete the existing slug and to save the entry again. Is the a better solution for my problem?

Thank you very much for your help!

**Tags:** slug, entry-slug

> **Comments:**
> **username_1**: Have you tried to change the search term options and to exclude (only include other attributes) the slug? https://craftcms.com/docs/config-settings#defaultSearchTermOptions  This way you don't have to work around the search.  
> **username_0**: Thank you. But this would only work in the front-end, but not in the back-end.  

---

## 1 answers

### Answer by username_2 on 2017-05-09. Score: 1 | Accepted answer

Seems like a good case for a [simple plugin](https://pluginfactory.io) that listened to the [`onBeforeSaveEntry`](https://craftcms.com/docs/plugins/events-reference#entries-onBeforeSaveEntry) event.

That plugin could verify the entry is in the section you're looking for, compare the existing slug against any saved in the database and do whatever you want to do from there (set it null, etc.).

> **Comments:**
> **username_0**: Thank you, I've created a simple plugin that writes the slug always new when an entry is saved. Works perfect.  

---

