Recoverable error Object of class Craft\ElementCriteriaModel could not be converted to string after Update After running Craft update I'm getting error on the meta author, meta description and meta keywords fields. Any idea how to resolve issue?


  Recoverable error
  Object of class Craft\ElementCriteriaModel could not be converted to string


Error Output:


Template Code:

{% set site_title = 'site title here' %}

{#
    ENTRY FALLBACK
    Not all pages have entries associated with them, e.g. search results, login page, etc.
#}
{% if entry.id is not defined %}
    {% set entry = craft.entries.id(2) %}
{% endif %}

{#
   HOMEPAGE DATA
   Used as a fallback for when meta values don't exist in this entry
#}
{% set homepage_entry = craft.entries.id(2) %}


&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
    &lt;title&gt;{{ entry.id == '2' ? site_title : entry.title ~ ' &gt; ' ~ site_title }}&lt;/title&gt;
    &lt;meta name="author" content="{{ entry.metaAuthor ? entry.metaAuthor : homepage_entry.metaAuthor }}" /&gt;
    &lt;meta name="description" content="{{ entry.metaDescription ? entry.metaDescription : homepage_entry.metaDescription }}" /&gt;
    &lt;meta name="keywords" content="{{ entry.metaKeywords ? entry.metaKeywords|join(',') : homepage_entry.metaKeywords|join(',') }}" /&gt;
    &lt;link rel="shortcut icon" href="images/favicon.ico" /&gt;
    &lt;link rel="stylesheet" type="text/css" href="/css/all.css"&gt;
    &lt;link rel="stylesheet" type="text/css" href="/css/nav.css"&gt;
&lt;/head&gt;


Any idea what issue is, how to resolve and why this broke?
Try something like this:

{% set author = entry.metaAuthor|length ? entry.metaAuthor[0] : homepage_entry.metaAuthor[0] }}

&lt;meta name="author" content="{{ author }}" /&gt;