<p>Here is Craft CMS 3 solution:</p>

<p><a href="http://craftsnippets.com/articles/quick-edit" rel="nofollow noreferrer">http://craftsnippets.com/articles/quick-edit</a></p>

<p>It works both with entries and categories and it takes multiple things into account while deciding if edit link should be displayed:</p>

<ul>
<li>If the current user has access rights to control panel?</li>
<li>If the current user has rights to edit current entry/category?</li>
<li>If entry/category is not displayed through live preview?</li>
</ul>

CC BY-SA 4.0
2019-03-30T10:54:43.510Z
2019-03-30T10:54:43.510Z
Piotr Pogorzelski
<p>There is! It's called <a href="http://buildwithcraft.com/classreference/models/EntryModel#cpEditUrl-detail" rel="noreferrer">cpEditUrl</a>.</p>

<pre><code>{% if currentUser %}
   {% if currentUser.isInGroup('admin') %}
       &lt;a href="{{ entry.cpEditUrl }}"&gt;Edit entry&lt;/a&gt;
   {% endif %}
{% endif %}
</code></pre>

<p>Or shorter (thanks to MISC):</p>

<pre><code>{% if currentUser.admin %}
    &lt;a href="{{ entry.cpEditUrl }}"&gt;Edit entry&lt;/a&gt;
{% endif %}
</code></pre>

<p>Or forget user group altogether (thanks to Phil Gyford and bennobo):</p>

<pre><code>{% if entry.isEditable() %}
    &lt;a href="{{ entry.cpEditUrl }}"&gt;Edit entry&lt;/a&gt;
{% endif %}
</code></pre>

CC BY-SA 3.0
2015-07-09T12:56:19.777Z
Alternatively, you can use `{% if entry.isEditable() %}` as in this answer: http://craftcms.stackexchange.com/questions/130/how-can-i-grant-front-end-access-to-an-entry-that-belongs-to-the-current-user
Phil Gyford
CC BY-SA 3.0
2015-08-02T06:50:46.920Z
Or even shorter: {% if currentUser.admin %}
MISC
CC BY-SA 3.0
2015-02-10T23:33:03.157Z
You are the man, Douglas!
taylor
CC BY-SA 3.0
2016-05-25T22:30:44.273Z
I think that `{% if entry.isEditable() %}` is the way to go as it totally forgets the user/group logic. It's just one simple question: **Can you edit?**
bennobo
CC BY-SA 3.0
2015-02-10T23:28:59.397Z
2016-05-27T16:49:17.163Z
2016-05-27T16:49:17.163Z
Douglas McDonald
<p>I want to add an "Edit entry" button on each page for admin users. Am I overlooking a simple way to output the Edit link to the CP edit page for the current entry? Curious if there is something like <code>{{ entry.editLink }}</code></p>

<templating><control-panel>
Get Entry Edit Link in Twig
# Get Entry Edit Link in Twig

(Asked by: username_0 on 2015-02-10)

I want to add an "Edit entry" button on each page for admin users. Am I overlooking a simple way to output the Edit link to the CP edit page for the current entry? Curious if there is something like `{{ entry.editLink }}`

**Tags:** templating, control-panel


---

## 2 answers

### Answer by username_2 on 2015-02-10. Score: 23 | Accepted answer

There is! It's called cpEditUrl.
{% if currentUser %}
   {% if currentUser.isInGroup('admin') %}
       Edit entry
   {% endif %}
{% endif %}

Or shorter (thanks to username_4):
{% if currentUser.admin %}
    Edit entry
{% endif %}

Or forget user group altogether (thanks to username_3 and username_5):
{% if entry.isEditable() %}
    Edit entry
{% endif %}

> **Comments:**
> **username_0**: You are the man, Douglas!  
> **username_3**: Alternatively, you can use `{% if entry.isEditable() %}` as in this answer: http://craftcms.stackexchange.com/questions/130/how-can-i-grant-front-end-access-to-an-entry-that-belongs-to-the-current-user  
> **username_4**: Or even shorter: {% if currentUser.admin %}  
> **username_5**: I think that `{% if entry.isEditable() %}` is the way to go as it totally forgets the user/group logic. It's just one simple question: **Can you edit?**  

---

### Answer by username_1 on 2019-03-30. Score: 1

Here is Craft CMS 3 solution:

<http://craftsnippets.com/articles/quick-edit>

It works both with entries and categories and it takes multiple things into account while deciding if edit link should be displayed:

* If the current user has access rights to control panel?
* If the current user has rights to edit current entry/category?
* If entry/category is not displayed through live preview?


---

