on my wp5.03 (though warnings were thrown Jan 7 and 19 so 5.02 or )

from public_html/error_log

PHP Warning: trim() expects parameter 1 to be string, array given in ... /wp-includes/class-wp-query.php on line 736

anyone else?

  • Have you turned off all the plugins and switched to a default theme, to ensure that it is, in fact, WordPress (and not a plugin or a theme) that's throwing the error?
    – Pat J
    Jan 28, 2019 at 16:38
  • Thanks Pat, that's the first thing I thought about, however, as the error isn't fatal, and as the error has only happened a few times in the past month, turning things off or changing themes on the production site isn't an option atm. I'll keep a watch on this post though.
    – Cody G
    Jan 28, 2019 at 17:11

1 Answer 1


As you can see here (https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-includes/class-wp-query.php#L736), the 736 line of that file contains:

$qv['name'] = trim( $qv['name'] );

And $qv is defined as:

$this->query_vars = $this->fill_query_vars($this->query_vars);
$qv = &$this->query_vars;

So... That means, that you use WP_Query incorrectly somewhere in your code...

You should pass string value as name param, and it looks like somewhere in your site an array is passed as that param...

  • Thanks Krzysiek ... 'Somewhere in your site' is a big place and I just took this project on ... any chance of me narrowing it down to a dir or two ?
    – Cody G
    Jan 28, 2019 at 17:06
  • Sorry, I'm afraid not. At least not based on what you've posted here. Jan 28, 2019 at 17:16
  • 1
    Try hitting the major pages, homepage, an internal page, archive, single post, see which of those triggers that same error to help narrow it down. Also, if you bring this locally, you can install and activate Query Monitor.
    – Ishio
    Jan 28, 2019 at 17:20

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.