Invalid argument supplied for foreach()
-
I’ve written a simple plugin to add a couple of post types to my multisite installation. One of the post types has a meta field which contains a drop down list of posts from the other post type. However I’m getting the following error;
Invalid argument supplied for foreach() in blaa\wp-includes\query.php on line 1702
My code to populate the dropdown is as follows;
$properties = get_posts( array( 'post_type' => 'property', 'posts_per_page' => -1 ) ); $propertyList = array(); if( $properties ) { foreach( $properties as $property ) { $propertyList[] = array( 'id' => $property->ID, 'name' => $property->post_title ); } }
I’ve been looking and trying to fix this for a couple of hours now but I’m beaten. Has anyone any suggestions?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Invalid argument supplied for foreach()’ is closed to new replies.