Craft CMS 5 Guide

Multiple Authors Per Entry

Rejoice, you can now assign more than one author to an entry!

Before you can use mul­ti­ple authors, you need to change the Max Authors” set­ting in the sec­tion set­tings to greater than 1 (default).

A user is only assign­a­ble as an author if the user has at least View Entries per­mis­sion of the sec­tion where the entries are locat­ed. The best way to do this is to cre­ate one or more user groups with the appro­pri­ate per­mis­sions and assign users you want to be authors to those groups.

User do not need the con­trol pan­el access per­mis­sion in order to be includ­ed as an author.

To access the authors in Twig, you can do one of the following:

Loop over all authors:

	{% for author in entry.authors %}
		{{ author.fullName ?? author.username }} {# falling back to username #}
	{% endfor %}

Map authors and join by comma:

{{  entry.authors | map(author => "#{author.fullname}" ?? "#{author.username}") | join(', ') }}

To get the entries by an author or authors:

{% set myEntries = craft.entries.authorId(1).all() %} {# return entries where one of the authors matches the passed in ID  #}

or

{% set entries = craft.entries.authorsIds([1,2]) %} {# returns only entries with both authors #}

Craft CMS 5 Guide is made up of the following videos: