<p>Here's an example of accessing an entry's version history that Nathaniel Hammond <a href="https://twitter.com/nfourtythree/status/1126564755852992513" rel="nofollow noreferrer">recently shared on Twitter</a>:</p>

<pre><code>{#
Options for getVersionsByEntryId
* @param int $entryId The entry ID to search for.
* @param int|null $siteId The site ID to search for.
* @param int|null $1 limit The limit on the number of versions to retrieve.
* @param bool $includeCurrent Whether to include the current "top" version of the entry.
* @param bool $withContent Whether the field content should be included on the versions.
* @return EntryVersion[]
#}
{% set entryId = 7 %}
{% set siteld = null %}
{% set limit = null %}
{% set includeCurrent = true %}
{% set withContent = false %}
{% set versions = craft.app.entryRevisions.getVersionsByEntryId(entryId, siteId, limit, includeCurrent, withContent) ?? null %}

{% if versions|length %}
  &lt;ul&gt;
    {% for version in versions if version.getCreator() %}
      &lt;li&gt;{{ version.getCreator().username }}&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
{% endif %}
</code></pre>

<p>In this example he's accessing the version's creator and displaying that, but you could easily swap that out for whatever you need to do, such as grabbing the version creation date etc.</p>

CC BY-SA 4.0
2019-05-29T15:16:42.647Z
Incredible thank you!
alex morris
CC BY-SA 4.0
2019-05-24T11:11:31.807Z
2019-05-24T11:11:31.807Z
Jalen Davenport
<p>We have some content that needs to display a log of changes (legal docs, terms etc) </p>

<p>Could I use version history for this? </p>

<p>I found this for Craft 2 but doesn't work on 3...</p>

<p><a href="https://craftcms.stackexchange.com/questions/9050/how-can-i-display-entry-edit-history-on-the-front-end">How can I display entry edit history on the front end?</a></p>

<entries><entry-versions>
Show entry version history on front end
# Show entry version history on front end

(Asked by: username_0 on 2019-05-24)

We have some content that needs to display a log of changes (legal docs, terms etc)

Could I use version history for this?

I found this for Craft 2 but doesn't work on 3...

[How can I display entry edit history on the front end?](https://craftcms.stackexchange.com/questions/9050/how-can-i-display-entry-edit-history-on-the-front-end)

**Tags:** entries, entry-versions

---

## 1 answers

### Answer by username_1 on 2019-05-24. Score: 3 | Accepted answer

Here's an example of accessing an entry's version history that Nathaniel Hammond recently shared on Twitter:
{#
Options for getVersionsByEntryId
* @param int $entryId The entry ID to search for.
* @param int|null $siteId The site ID to search for.
* @param int|null $1 limit The limit on the number of versions to retrieve.
* @param bool $includeCurrent Whether to include the current "top" version of the entry.
* @param bool $withContent Whether the field content should be included on the versions.
* @return EntryVersion[]
#}
{% set entryId = 7 %}
{% set siteld = null %}
{% set limit = null %}
{% set includeCurrent = true %}
{% set withContent = false %}
{% set versions = craft.app.entryRevisions.getVersionsByEntryId(entryId, siteId, limit, includeCurrent, withContent) ?? null %}

{% if versions|length %}
  
    {% for version in versions if version.getCreator() %}
      {{ version.getCreator().username }}
    {% endfor %}
  
{% endif %}

In this example he's accessing the version's creator and displaying that, but you could easily swap that out for whatever you need to do, such as grabbing the version creation date etc.

> **Comments:**
> **username_0**: Incredible thank you!  

---

