diff --git src/wp-includes/compat.php src/wp-includes/compat.php
index 7377a384c8..83221c74fc 100644
--- src/wp-includes/compat.php
+++ src/wp-includes/compat.php
@@ -505,3 +505,22 @@ endif;
 if ( ! function_exists( 'spl_autoload_register' ) ) {
 	require_once ABSPATH . WPINC . '/spl-autoload-compat.php';
 }
+
+if ( ! function_exists( 'is_iterable' ) ) {
+	/**
+	 * Polyfill for is_iterable function added in PHP 7.1.
+	 *
+	 * Verify that the content of a variable is a non-empty array or an object
+	 * implementing the Traversable interface.
+	 *
+	 * @since 5.0
+	 *
+	 * @param mixed $var Variable to check.
+	 *
+	 * @return bool Whether the provided variable is iterable.
+	 */
+	function is_iterable( $var ) {
+		return ( is_array( $var ) && ! empty( $var ) )
+			|| $var instanceof Traversable;
+	}
+}
diff --git tests/phpunit/tests/compat.php tests/phpunit/tests/compat.php
index 3d873745b9..1dd0c925d4 100644
--- tests/phpunit/tests/compat.php
+++ tests/phpunit/tests/compat.php
@@ -186,6 +186,25 @@ EOT;
 		$this->assertEquals( '["foo"]', $json->encodeUnsafe( array( 'foo' ) ) );
 		$this->assertEquals( array( 'foo' ), $json->decode( '["foo"]' ) );
 	}
+
+	/**
+	 * @dataProvider iterable_variable_test_data
+	 * @param mixed $variable
+	 * @param bool $expected
+	 */
+	function test_is_iterable( $variable, $expected ) {
+		$this->assertEquals( is_iterable( $variable ), $expected );
+	}
+
+	function iterable_variable_test_data() {
+		return array(
+			array( array( 1, 2, 3 ), true ),
+			array( new \ArrayIterator( array( 1, 2, 3 ) ), true ),
+			array( 1, false ),
+			array( 3.14, false ),
+			array( new stdClass(), false ),
+		);
+	}
 }
 
 /* used in test_mb_substr_phpcore */
