diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
index 2e258a88ea..3370d165b4 100644
--- a/src/wp-includes/compat.php
+++ b/src/wp-includes/compat.php
@@ -374,3 +374,9 @@ function is_iterable( $var ) {
 		return ( is_array( $var ) || $var instanceof Traversable );
 	}
 }
+
+if ( ! function_exists( 'str_contains' ) ) {
+	function str_contains( $haystack, $needle ) {
+		return '' === $needle || false !== strpos( $haystack, $needle );
+	}
+}
