<p>You can use an <a href="https://craftcms.com/docs/5.x/reference/element-types/entries.html#querying-entries" rel="nofollow noreferrer">entry query</a> to find all entries that a given entry is related to. The following assumes that the <code>entry</code> variable is an entry in your call to action channel.</p>
<pre class="lang-twig prettyprint-override"><code>{% set entriesUsingCTA = craft.entries()
    .relatedTo({ targetElement: entry })
    .all()
%}
</code></pre>
<p>You can further limit this to specific sections or specific fields if needed, see the <a href="https://craftcms.com/docs/5.x/system/relations.html" rel="nofollow noreferrer">documentation on relations</a> for details.</p>
<p>If you want to this information directly in the entry form, you can place a <a href="https://craftcms.com/docs/5.x/system/fields.html#ui-elements" rel="nofollow noreferrer">template UI element</a>. In the template, use the query above to find all related entries and output them as a list:</p>
<pre class="lang-twig prettyprint-override"><code>&lt;ul&gt;
    {% for entry in entriesUsingCTA %}
        &lt;li&gt;&lt;a href=&quot;{{ entry.getCpEditUrl() }}&quot;&gt;
            {{ entry.title }}
        &lt;/a&gt;&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
</code></pre>

CC BY-SA 4.0
2024-06-26T10:59:44.487Z
Thanks so much for this, do you know if there is a way to do this in the CMS so the editors can review the used components?
Amy
CC BY-SA 4.0
2024-06-26T12:16:58.283Z
@Amy … yes, see the last paragraph.
MoritzLost
CC BY-SA 4.0
2024-07-16T20:18:51.983Z
Oh, totally missed that! Thanks so much for the help this is perfect.
Amy
CC BY-SA 4.0
2024-07-17T07:13:59.687Z
@Amy You're welcome. Don't forget to mark the answer as accepted ;)
MoritzLost
CC BY-SA 4.0
2024-06-26T09:24:27.650Z
2024-06-26T09:24:27.650Z
MoritzLost
<p>I'm looking to see if there is a way to locate all the instances/pages a channel item exists on in the CMS. In this situation we have a channel for call to action panels that can be added to any page created in the CMS.
Is there a way to work out what all the pages are that the item is added to so I can be sure amending the content in a CTA panel will work in all of the locations it has been added to.
Any help would be greatly appreciated. :)</p>

<channels>
Can you locate all the pages that a channel item has been added to?
# Can you locate all the pages that a channel item has been added to?

(Asked by: username_0 on 2024-06-26)

I'm looking to see if there is a way to locate all the instances/pages a channel item exists on in the CMS. In this situation we have a channel for call to action panels that can be added to any page created in the CMS.
Is there a way to work out what all the pages are that the item is added to so I can be sure amending the content in a CTA panel will work in all of the locations it has been added to.
Any help would be greatly appreciated. :)

**Tags:** channels

---

## 1 answers

### Answer by username_1 on 2024-06-26. Score: 2

You can use an entry query to find all entries that a given entry is related to. The following assumes that the entry variable is an entry in your call to action channel.
{% set entriesUsingCTA = craft.entries()
    .relatedTo({ targetElement: entry })
    .all()
%}

You can further limit this to specific sections or specific fields if needed, see the documentation on relations for details.
If you want to this information directly in the entry form, you can place a template UI element. In the template, use the query above to find all related entries and output them as a list:

    {% for entry in entriesUsingCTA %}
        
            {{ entry.title }}
        
    {% endfor %}

> **Comments:**
> **username_0**: Thanks so much for this, do you know if there is a way to do this in the CMS so the editors can review the used components?  
> **username_1**: @Amy … yes, see the last paragraph.  
> **username_0**: Oh, totally missed that! Thanks so much for the help this is perfect.  
> **username_1**: @Amy You're welcome. Don't forget to mark the answer as accepted ;)  

---

