<p>You can fetch the revisions of an element using the <a href="https://docs.craftcms.com/api/v5/craft-elements-db-elementqueryinterface.html#method-revisionof" rel="nofollow noreferrer"><code>revisionOf()</code></a> method on an element query.</p>
<pre><code>{# @var entry craft\elements\Entry #}
{% if entry.hasRevisions() %}
    {% set revisions = craft.entries.revisionOf(entry).all() %}
    {% for revision in revisions %}
        {{ revision.title }}
    {% endfor %}
{% endif %}
</code></pre>

CC BY-SA 4.0
2024-04-25T19:58:08.373Z
Great, thanks.
I guess it should be possible to access the data of the revision like this: `craft.entries.revisionId( revId ).revisions( true ).one`
Unfortunately I don't get any results. Any idea why this isn't working?
obs
CC BY-SA 4.0
2024-04-29T02:26:09.273Z
Maybe, that’s not what you asked though.
Ben Croker
CC BY-SA 4.0
2024-04-25T13:28:52.383Z
2024-04-25T13:28:52.383Z
Ben Croker
<p>I'm basically trying to get what has been answered for <a href="https://craftcms.stackexchange.com/questions/16939/display-old-entry-version-content-through-twig">this questions</a>. This code doesn't seem to work any longer since it has been solved about 8 years ago.</p>
<p>Is there a way to get a list of all the revisions of an entry using twig? Further I would like to access the data of the revisions to show previous versions of an entry in the front end as well.</p>

<craft5><revisions>
Get all revisions of an entry on front end / with twig
# Get all revisions of an entry on front end / with twig

(Asked by: username_0 on 2024-04-25)

I'm basically trying to get what has been answered for [this questions](https://craftcms.stackexchange.com/questions/16939/display-old-entry-version-content-through-twig). This code doesn't seem to work any longer since it has been solved about 8 years ago.

Is there a way to get a list of all the revisions of an entry using twig? Further I would like to access the data of the revisions to show previous versions of an entry in the front end as well.

**Tags:** craft5, revisions


---

## 1 answers

### Answer by username_1 on 2024-04-25. Score: 3 | Accepted answer

You can fetch the revisions of an element using the revisionOf() method on an element query.
{# @var entry craft\elements\Entry #}
{% if entry.hasRevisions() %}
    {% set revisions = craft.entries.revisionOf(entry).all() %}
    {% for revision in revisions %}
        {{ revision.title }}
    {% endfor %}
{% endif %}

> **Comments:**
> **username_0**: Great, thanks. I guess it should be possible to access the data of the revision like this: `craft.entries.revisionId( revId ).revisions( true ).one` Unfortunately I don't get any results. Any idea why this isn't working?  
> **username_1**: Maybe, that’s not what you asked though.  

---

