Support » Plugin: Search & Filter » Headers Already Sent Error

  • Hello. Could you please help me understand why I am getting this error message? Thanks!

    Warning: Invalid argument supplied for foreach() in /home3/wag5540aej66/public_html/wp-content/plugins/search-filter/search-filter.php on line 578

    Warning: Cannot modify header information – headers already sent by (output started at /home3/wag5540aej66/public_html/wp-content/plugins/search-filter/search-filter.php:578) in /home3/wag5540aej66/public_html/wp-admin/post.php on line 198

    Warning: Cannot modify header information – headers already sent by (output started at /home3/wag5540aej66/public_html/wp-content/plugins/search-filter/search-filter.php:578) in /home3/wag5540aej66/public_html/wp-includes/pluggable.php on line 1216

Viewing 3 replies - 1 through 3 (of 3 total)
  • I had the same error.

    The current version of the Search & Filter plugin breaks with the latest version of PHP (7.2.5). When I rolled back to an older version of PHP (5.6.36, 7.0.30, 7.1.18), this error went away.

    Hopefully, the author will update the plugin to be PHP 7.2 compatible.

    I got the plugin working in PHP 7.2 by editing the source code.

    [search-filter.php]
    //loop through all the query vars
    foreach($wp_query->query as $key=>$val)

    UPDATED–>
    //loop through all the query vars
    foreach((array) $wp_query->query as $key=>$val)

    CREDIT (2nd answer):
    https://stackoverflow.com/questions/2630013/invalid-argument-supplied-for-foreach

    Thank you, @coffeehero. I made that fix, and all is well.

    FWIW, it’s not just pre-7.2 versions of php that generate the error.

    I echo your hope that the plugin author will update the plugin to fix the error.

    I find the plugin very useful, especially for filtering categories and tags even without the search box. I’m in the midst of writing a blog article extolling the plugin’s virtues, and I’d like to be able to remove the disclaimer I feel a need to add, referencing the bug.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.