<p>You can use the <code>revisionOf</code> parameter (<a href="https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#revisionof" rel="nofollow noreferrer">docs</a>).</p>

<pre class="lang-twig prettyprint-override"><code>{% set revisions = craft.entries.revisionOf(element.id).all|default(1) %}
</code></pre>

CC BY-SA 4.0
2019-10-25T12:59:53.640Z
Thanks again Oli!
Jamie Wade
CC BY-SA 4.0
2019-10-25T08:57:05.050Z
2019-10-25T08:57:05.050Z
Oli
<p>We are using <code>getVersionsByEntryId</code> in our XML sitemap to return the number of times an entry has been saved, then comparing that with todays date and the date the entry was created to determine the <code>changefreq</code> over that time:</p>

<pre><code>{% set revisions = craft.app.entryRevisions.getVersionsByEntryId(element.id)|default(1)|length %}
</code></pre>

<p>Looking at the <a href="https://docs.craftcms.com/api/v3/craft-services-entryrevisions.html#public-methods" rel="nofollow noreferrer">docs</a> however, this is now deprecated:</p>

<blockquote>
  <p>DEPRECATED</p>
  
  <p>Deprecated in 3.2. Use an entry query instead.</p>
</blockquote>

<p>I can't seem to find anything in the docs for an entry query? Could someone point me in the right direction?</p>

CC BY-SA 4.0
2019-10-24T13:07:49.793Z
I think this is what you need - https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#revisionof
Oli
CC BY-SA 4.0
2019-10-24T14:32:13.330Z
Cheers Oli, that's exactly what I needed: `{% set revisions = craft.entries.revisionOf(element.id).all|default(1) %}`. Please post that as an answer and I'll accept :-)
Jamie Wade
<elementquery>
getVersionsByEntryId is deprecated. Can't find the new method?
# getVersionsByEntryId is deprecated. Can't find the new method?

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

We are using getVersionsByEntryId in our XML sitemap to return the number of times an entry has been saved, then comparing that with todays date and the date the entry was created to determine the changefreq over that time:
{% set revisions = craft.app.entryRevisions.getVersionsByEntryId(element.id)|default(1)|length %}

Looking at the docs however, this is now deprecated:

DEPRECATED
Deprecated in 3.2. Use an entry query instead.

I can't seem to find anything in the docs for an entry query? Could someone point me in the right direction?

**Tags:** elementquery
> **Comments:**
> **username_1**: I think this is what you need - https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#revisionof  
> **username_0**: Cheers Oli, that's exactly what I needed: `{% set revisions = craft.entries.revisionOf(element.id).all|default(1) %}`. Please post that as an answer and I'll accept :-)  

---

## 1 answers

### Answer by username_1 on 2019-10-25. Score: 2 | Accepted answer

You can use the revisionOf parameter (docs).
{% set revisions = craft.entries.revisionOf(element.id).all|default(1) %}

> **Comments:**
> **username_0**: Thanks again Oli!  

---

