<p>You could write a simple plugin that listened to the <a href="https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry" rel="nofollow noreferrer"><code>onSaveEntry</code></a> and perform whatever custom business logic you require for slugs.</p>

<p>Don't re-save that entry going through <code>craft()-&gt;entries-&gt;saveEntry()</code>, though, or else you'll create an infinite loop by firing the <code>onSaveEntry</code> event again.</p>

<p>You could either call <code>craft()-&gt;elements-&gt;saveElement()</code> directly or use use <a href="http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder" rel="nofollow noreferrer">QueryBuilder</a> to directly update the database with the slug.</p>

CC BY-SA 3.0
2017-02-27T19:50:51.350Z
Thanks Brad, but writing plugins is beyond my skill set at the moment. But I suspect I'm going to have to learn to at some point.
Paul Frost
CC BY-SA 3.0
2017-02-27T18:00:05.817Z
2017-02-27T18:00:05.817Z
Brad Bell
<p>It could be as easy as training your users to delete the slug. If you delete the slug and save the entry will update it.</p>

CC BY-SA 3.0
2017-04-29T13:02:18.910Z
My experience is that users forget, and the more automation you include makes it easier for everyone.
Paul Frost
CC BY-SA 3.0
2017-04-28T19:11:22.217Z
2017-04-28T19:11:22.217Z
AbbeyDesign
<p>I'm using the auto generate entry titles from custom fields option, eg</p>

<p>{eventVenue}-{seriesName}-{eventDate}</p>

<p>But sometimes the eventVenue isn't known at the time of creating the entry, so you can end up with a slug of tba-winter-2017-04-15. But when they later update the eventVenue the slug is not right. It's not very easy to explain to users that they can/should change the slug and for them to remember to do so.</p>

<p>I fully understand the thinking that in many cases the slug shouldn't change due to existing links that may exist and will now break, but is there a way to override the default?</p>

<p>In ExpressionEngine I used an addon, "Title Master" that had the option to update url on edit or not.</p>

CC BY-SA 3.0
2017-04-28T20:01:59.197Z
Changing the slug (and URL) after the entry has already been published is a bad idea – you'll hurt your SEO as well as annoy any users who might've shared, linked to or bookmarked the old URL. You should consider using a different URL format altogether, that isn't dependent on the event venue, or maybe just live with the fact that some of the entries will have "incomplete" URLs.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2017-04-29T13:01:13.470Z
The reason to include the date and the event venue and series name is because the venue and series are used repeatedly (and sometimes on the same day) and the combination of all three ensures the url is always unique and readable. I prefer url's to be readable rather than random or obscure.
Paul Frost
<control-panel><config><entry-slug>
How can I force a slug to update on save
# How can I force a slug to update on save

(Asked by: username_0 on 2017-02-27)

I'm using the auto generate entry titles from custom fields option, eg

{eventVenue}-{seriesName}-{eventDate}

But sometimes the eventVenue isn't known at the time of creating the entry, so you can end up with a slug of tba-winter-2017-04-15. But when they later update the eventVenue the slug is not right. It's not very easy to explain to users that they can/should change the slug and for them to remember to do so.

I fully understand the thinking that in many cases the slug shouldn't change due to existing links that may exist and will now break, but is there a way to override the default?

In ExpressionEngine I used an addon, "Title Master" that had the option to update url on edit or not.

**Tags:** control-panel, config, entry-slug

> **Comments:**
> **username_1**: Changing the slug (and URL) after the entry has already been published is a bad idea – you'll hurt your SEO as well as annoy any users who might've shared, linked to or bookmarked the old URL. You should consider using a different URL format altogether, that isn't dependent on the event venue, or maybe just live with the fact that some of the entries will have "incomplete" URLs.  
> **username_0**: The reason to include the date and the event venue and series name is because the venue and series are used repeatedly (and sometimes on the same day) and the combination of all three ensures the url is always unique and readable. I prefer url's to be readable rather than random or obscure.  

---

## 2 answers

### Answer by username_2 on 2017-02-27. Score: 1

You could write a simple plugin that listened to the [`onSaveEntry`](https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry) and perform whatever custom business logic you require for slugs.

Don't re-save that entry going through `craft()->entries->saveEntry()`, though, or else you'll create an infinite loop by firing the `onSaveEntry` event again.

You could either call `craft()->elements->saveElement()` directly or use use [QueryBuilder](http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder) to directly update the database with the slug.

> **Comments:**
> **username_0**: Thanks Brad, but writing plugins is beyond my skill set at the moment. But I suspect I'm going to have to learn to at some point.  

---

### Answer by username_3 on 2017-04-28. Score: 1

It could be as easy as training your users to delete the slug. If you delete the slug and save the entry will update it.

> **Comments:**
> **username_0**: My experience is that users forget, and the more automation you include makes it easier for everyone.  

---

