• Resolved DragonDon

    (@dragondon)


    Greetings all,

    One of the sites I setup has an oddball behaviour. If you search for something that isn’t found, the following shows up:

    Warning: Invalid argument supplied for foreach() in /<DIRECTORY-STRUCTURE/wp-includes/post.php on line 3561
    
    Nothing Found
    
    Sorry, but nothing matched your search criteria. Please try again with some different keywords.

    WP Version: 3.6

    Any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter DragonDon

    (@dragondon)

    Err….hang on….forgot to search the forums….geeze…clueless me.

    Thread Starter DragonDon

    (@dragondon)

    Ok, if I switch to the Twentythirteen theme, the problem goes away. Question is, why?

    I tried deactivating all the plugins, which didn’t have any affect on the search.

    One site suggested supressing php notifications. Not really convinced that is the best way.

    A response on this thread seemed to have worked for me:

    ***
    I read several posts about putting (array) in front of the variable and while I am clueless about how or why it works, it stopped the darn error messages on my web site! Yay!

    /**
     * Builds URI for a page.
     *
     * Sub pages will be in the "directory" under the parent page post name.
     *
     * @since 1.5.0
     *
     * @param mixed $page Page object or page ID.
     * @return string Page URI.
     */
    function get_page_uri($page) {
    	if ( ! is_object($page) )
    		$page = get_post( $page );
    	$uri = $page->post_name;
    /* Added (array) in the offending line below */
    	foreach ( (array)$page->ancestors as $parent ) {
    		$uri = get_post( $parent )->post_name . "/" . $uri;
    	}
    
    	return $uri;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘search reveals directory structure??’ is closed to new replies.