diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
index 7377a384c8..2cd63aef3e 100644
--- a/src/wp-includes/compat.php
+++ b/src/wp-includes/compat.php
@@ -505,3 +505,17 @@ function array_replace_recursive( $base = array(), $replacements = array() ) {
 if ( ! function_exists( 'spl_autoload_register' ) ) {
 	require_once ABSPATH . WPINC . '/spl-autoload-compat.php';
 }
+
+if ( ! function_exists( 'is_countable' ) ) :
+	/**
+	 * Polyfill for is_countable function added in PHP 7.3.
+	 * Verify that the content of a variable is an array or an object
+	 * implementing Countable
+	 *
+	 * @param mixed $var The value to check.
+	 * @return bool Returns TRUE if var is countable, FALSE otherwise.
+	 */
+	function is_countable( $var ) {
+		return ( is_array( $var ) || $var instanceof Countable );
+	}
+endif;
