<p>You are trying to merge an object of type <code>ElementQuery</code> with an array so your object will be transformed as an array and merged with the new array. Of course you'll end up having an array instead of a query so you can't execute it in order to fetch the entries.</p>

<p>Instead of merging it, why not setting the parameter directly?</p>

<pre><code>{% do param.authorId(author) %}
</code></pre>

<p>Furthermore authors are not related to entries  (except you set them in an additional field) </p>

CC BY-SA 4.0
2018-10-10T20:28:39.530Z
did not know about {% do blah %} thank you. That worked.
CreateSean
CC BY-SA 4.0
2018-10-10T19:40:22.357Z
2018-10-10T19:40:22.357Z
Robin Schambach
<p>I'm having trouble limiting next/previous links in one channel to articles by the author.</p>

<p>next/previous links are working correctly on the regular blog but when included on the DJ blog I get <code>unknown property errors</code> in the template.</p>

<p>If I remove the <strong>merge</strong> line below pagination appears to work, but includes DJ posts not by the current Dj.</p>

<p>url looks like <code>https://domain.com/djs/503/firstName-lastName</code> where 503 is the author.id</p>

<hr>

<pre><code>{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section(channel).orderBy('title asc') %}

{# if djs channel limit to author based on url segment 2 which is author id #}
{% if craft.app.request.segment(1) == 'djs' %}
  {# get dj to relate and limit next/prev #}
  {% set author = craft.app.request.getSegment(2) %}
  {# {% set dj = craft.users.id(author).one() %} #}

  {# {% set params = craft.entries.section('djBlog').relatedTo(author).orderBy('title asc') %} #}

  {% set params = params | merge({ relatedTo: author }) %}

{% endif %}
</code></pre>

<p>Below code is working on all other templates except the DJ blog where I need to restrict pagination to posts by the current author. Only including here in case it may be relevant though I don't think so.</p>

<pre><code>&lt;div class="entry-pagination grid-container"&gt; {# grid-container #}
  &lt;div class="grid-x grid-padding-x"&gt;
    &lt;div class="cell small-12 {% if backToPath == 'the-word-for-you-today' %}medium-12{% else %}medium-8 medium-offset-2{% endif %} next-prev"&gt;

      {% if prevEntry %}        
        &lt;a href="{{ prevEntry.url }}" class="prev-blog"&gt;
          {#&lt;img src="/assets/images/previous.png" alt=""&gt;#}
          {{ macros.icon("next", "icon-blue", "40", "40") }}
           Previous
        &lt;/a&gt;
      {% else %}
        &lt;a href="" class="prev-blog" disabled="true"&gt;
          {#&lt;img src="/assets/images/previous.png" alt=""&gt;#}
          {{ macros.icon("next", "icon-blue", "40", "40") }}
           Previous
        &lt;/a&gt;    
      {% endif %}

      {% if backTo == 'true' %}
        &lt;a href="/{{ backToPath }}" class="button"&gt;
          Back to {{ backToTitle }}
          {# &lt;img src="/assets/images/previous.png" alt=""&gt; #}
        &lt;/a&gt;&lt;!-- /.button --&gt;
      {% endif %}


      {% if nextEntry %}
        &lt;a href="{{ nextEntry.url }}" class="next-blog"&gt;&lt;span&gt;Next&lt;/span&gt;{{ macros.icon("next", "icon-blue", "40", "40") }}&lt;/a&gt;
      {% else %}
        &lt;a href="" class="next-blog" disabled="true"&gt;&lt;span&gt;Next&lt;/span&gt;{{ macros.icon("next", "icon-blue", "40", "40") }}&lt;/a&gt;
      {% endif %}
    &lt;/div&gt;&lt;!-- /.cell small-12 --&gt;
  &lt;/div&gt;&lt;!-- /.grid-x grid-padding-x --&gt;
&lt;/div&gt;&lt;!-- /.grid-container --&gt;
</code></pre>

<pagination><relatedto><author><previous-next>
Pagination: Next/Previous related to author
# Pagination: Next/Previous related to author

(Asked by: username_0 on 2018-10-10)

I'm having trouble limiting next/previous links in one channel to articles by the author.
next/previous links are working correctly on the regular blog but when included on the DJ blog I get unknown property errors in the template.
If I remove the merge line below pagination appears to work, but includes DJ posts not by the current Dj.
url looks like https://domain.com/djs/503/firstName-lastName where 503 is the author.id

{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section(channel).orderBy('title asc') %}

{# if djs channel limit to author based on url segment 2 which is author id #}
{% if craft.app.request.segment(1) == 'djs' %}
  {# get dj to relate and limit next/prev #}
  {% set author = craft.app.request.getSegment(2) %}
  {# {% set dj = craft.users.id(author).one() %} #}

  {# {% set params = craft.entries.section('djBlog').relatedTo(author).orderBy('title asc') %} #}

  {% set params = params | merge({ relatedTo: author }) %}

{% endif %}

Below code is working on all other templates except the DJ blog where I need to restrict pagination to posts by the current author. Only including here in case it may be relevant though I don't think so.
 {# grid-container #}
  
    

      {% if prevEntry %}        
        
          {##}
          {{ macros.icon("next", "icon-blue", "40", "40") }}
           Previous
        
      {% else %}
        
          {##}
          {{ macros.icon("next", "icon-blue", "40", "40") }}
           Previous
            
      {% endif %}

      {% if backTo == 'true' %}
        
          Back to {{ backToTitle }}
          {#  #}
        
      {% endif %}


      {% if nextEntry %}
        Next{{ macros.icon("next", "icon-blue", "40", "40") }}
      {% else %}
        Next{{ macros.icon("next", "icon-blue", "40", "40") }}
      {% endif %}

**Tags:** pagination, relatedto, author, previous-next


---

## 1 answers

### Answer by username_1 on 2018-10-10. Score: 1 | Accepted answer

You are trying to merge an object of type ElementQuery with an array so your object will be transformed as an array and merged with the new array. Of course you'll end up having an array instead of a query so you can't execute it in order to fetch the entries.
Instead of merging it, why not setting the parameter directly?
{% do param.authorId(author) %}

Furthermore authors are not related to entries  (except you set them in an additional field)

> **Comments:**
> **username_0**: did not know about {% do blah %} thank you. That worked.  

---

