0

pls help me to correct this (on my wordpress theme):

Warning: count(): Parameter must be an array or an object that implements Countable in generic.php on line 1104

1104:

1104    if(count($merged==0))
1105                $merged[]=0;
1106
1107    $params = array(
1108    'post__in' => $merged,
1109    'post_type' => $all_post_types,
1110    'posts_per_page' => -1,
1111     'suppress_filter' => false,
1112    'orderby' => 'post__in'
1113    );

I'm no coder so a copy and paste solution would be highly appriciated, thank you so much in advance

I tried and changed: 1104:

 if(count($merged==0))
                   $merged[]=0;
to just

if(count($merged)==0)
or
if($merged)==0)
or
if(!is_array($merged)==0))

that did nothing or screwed the side completely. I guess the Problem is after 7.2 the parameter NULL is no longer valid. so I checked the forum but nothing matches this specific "merged"

p-f-e
  • 1
  • 2
  • Try `if(count($merged)==0)` – Onimusha Jan 25 '21 at 15:02
  • pls read above, but thanks anayway – p-f-e Jan 25 '21 at 16:26
  • Try removing `count` as `$merged==0` is not a countable object. So try change it to `if($merged==0)` or `if(!$merged)` or `if(!is_array($merged))` - Sorry these are just basic guesses based on logic – Onimusha Jan 26 '21 at 09:30
  • @Onimusha thx for your help, but maybe I don't understand or there is more to it, the complete code structure is now updated above. Question should I delete the row 1105 then? – p-f-e Jan 26 '21 at 17:48
  • Does this answer your question? [count() parameter must be an array or an object that implements countable in laravel](https://stackoverflow.com/questions/53020833/count-parameter-must-be-an-array-or-an-object-that-implements-countable-in-lar) – Ulrich Eckhardt Jan 26 '21 at 18:03
  • 1
    Please start with the [tour] and read [ask]. Since you say you are not a coder and don't want to become one, I think this forum is not the right place for you because it aims at coders. – Ulrich Eckhardt Jan 26 '21 at 18:04
  • I suggested 3 edits separated by "or" - those were not part of the code. So try each one to see if it fixes it. However, I agree with @UlrichEckhardt that this isn't the right place since you're not a coder. You probably need to hire someone. – Onimusha Jan 27 '21 at 17:12

0 Answers0