Some of my links coming from a matrix field with entry became corrupted. Anyone had this before and knows how to fix it? admin field entry corrupted link enter image description here

  • It looks like you're trying to output an unexecuted Element Query. Please can you add your template code responsible for this output and we'll help explain how best to fix. Commented Jun 14, 2022 at 10:17
  • I added it. Thanks for your response!
    – aren
    Commented Jun 14, 2022 at 11:27

1 Answer 1


You're outputting an unexecuted Element Query. To clarify - the thing stored in your Entries field named buttonLink is not a Craft entry as you might expect, but is basically a raw unexecuted database query (that will fetch the selected entry once executed). In Craft 3 those unexecuted queries automatically got executed if you attempt to output them, but they should throw deprecation errors in the control panel (Utilities > Deprecation Errors). In Craft 4 you can't get away with that anymore.

The quick and easy solution is to execute the query. There are a few ways to execute queries: https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries

But really, the "proper" solution here is to add some eager loading so that all your child queries are combined into the queries used to fetch the parent matrix block(s). This is significantly more performant, especially if you're outputting multiple matrix blocks (though I see from your code you're only outputting one).

Here's how eager loading might look for your code:

{% set button = cta.button.with('buttonLink').one() %}
<a href="{{ button.buttonLink[0].url }}"><div class="button">{{ button.buttonText }}</div></a>

Or without eager loading (don't do this):

{% set button = cta.button.one() %}
<a href="{{ button.buttonLink.one().url }}"><div class="button">{{ button.buttonText }}</div></a>
  • Thank your very much for your answer!
    – aren
    Commented Jun 15, 2022 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.