I’ve run into an issue where I need to conditionally show content if an EE relationship field is empty. However the {if relationship-field} conditional is not working. Nor is any variation of that such as {if relationship-field == ""} or {if "{relationship-field}" == ""} or {if "{relationship-field}" != ""}. No dice on any of these.

3 Answers 3


The solution turns out to be fairly simple and the logic can pretty much work the same. EE relationship fields let you pull the count separately from the tag pair like this:


So, the solution is to use that in our conditional logic:

{if "{relationship-field:count}" == ""}
    do stuff
    do relationship stuff
  • Shouldn't it be ... == 0 instead of == "" ?
    – BNetz
    Commented Mar 26, 2016 at 0:06
  • This doesn't work in EE 3.5.11. what version does this apply to?
    – Andy
    Commented Oct 3, 2017 at 11:25

Long time to add to this but...

  do relationship stuff
  {if relationship-field:no_results}
    Empty stuuf
  • Thanks for this. I think this is the most up-to-date solution following changes to EE's conditionals. TJ Draper's code didn't work for me. Your no_results code worked like a charm. Commented Jun 19, 2015 at 13:53
  • Thank you for your answer, Nevsie-Modeten. Your no_results code example really helped me fix my problem.
    – user7225
    Commented Mar 24, 2016 at 18:14
  • I love you all... Just what I needed. Thanks.
    – samc449
    Commented Mar 31, 2016 at 9:16

I would like to add the following also works:

{if "{relationship_field:count}" == 1}
Do relationship stuff

In my case, I only want to display formatted content if there is relationship data:

{if "{bk_author:count}"=="1"}
<h5 class="small">by {bk_author backspace="2"}<a href="/author/{bk_author:url_title}">{bk_author:title}</a>, {/bk_author}

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.