Support » Fixing WordPress » foreach() invalid argument error for get_posts

  • Warning: Invalid argument supplied for foreach() in /home/rem/public_html/wp-includes/query.php on line 1401</p>
    <p>Warning: Invalid argument supplied for foreach() in /home/rem/public_html/wp-includes/query.php on line 1401</p>
    <p>Warning: Invalid argument supplied for foreach() in /home/rem/public_html/wp-includes/query.php on line 1401</p>
    <p>Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/rem/public_html/wp-includes/query.php on line 1791

    the errors above are caused by a plugin that i wrote to create a sitemap. i develop my plugins on a wordpress mu 2.7.1 install. i recently installed this plugin on a site i am currently developing, and received the above errors.

    below are the get_posts queries in the plugin that return the first 3 errors.

    $excludes = get_posts('post_type=any&numberposts=-1&meta_key=_ezsitemap_exclude&meta_value=1');
    $excludes = get_posts('post_type=any&numberposts=-1&meta_key=_ezsitemap_link&meta_value=1');
    $ezsitemap['queries']['pages'] = get_pages('orderby=title&order=asc&exclude='.$ezsitemap['filters']['pages']['hide']);

    $excludes is used in two places separated by several lines of coding (working with the results of the queries).

    on the wordpress mu site where i develop my plugins, i receive no errors. i also installed the plugin on a wordpress 2.7.1 site, and received no errors.

    is there something i am missing? why does this error occur?

    any help would be greatly appreciated…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘foreach() invalid argument error for get_posts’ is closed to new replies.