diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 8593e8c..a905494 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -5377,6 +5377,60 @@ function wp_validate_boolean( $var ) {
 }
 
 /**
+ * Filter/validate a variable as an integer.
+ *
+ * Alternative to `filter_var( $var, FILTER_VALIDATE_INT, $options )`.
+ *
+ * PHP can be compiled without fiter_var so WordPress avoids using it.
+ *
+ * @since 4.8.0
+ *
+ * @param mixed $var  Integer value to validate.
+ * @param array $args Optional. {
+ *     Arguments to control behavior. Default empty array.
+ *
+ *     @type mixed $default   Value to return for invalid values. Default false.
+ *     @type int|bool $min_range Lowest valid value. Default false (no minimum).
+ *     @type int|bool $max_range Highest valid value. Default false (no maximum).
+ * }
+ * @return mixed Integer if value is valid, $args['default'] if invalid.
+ */
+function wp_validate_integer( $var, $args = array() ) {
+	$defaults = array(
+		'default' => false,
+		'min_range' => false,
+		'max_range' => false,
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( false !== $args['min_range'] ) {
+		$args['min_range'] = wp_validate_integer( $args['min_range'] );
+	}
+
+	if ( false !== $args['max_range'] ) {
+		$args['max_range'] = wp_validate_integer( $args['max_range'] );
+	}
+
+	if ( ! is_numeric( $var ) || floor( $var ) != $var ) {
+		return $args['default'];
+	}
+
+	$var = (int) $var;
+
+	if ( false !== $args['min_range'] && $var < $args['min_range'] ) {
+		return $args['default'];
+	}
+
+	if ( false !== $args['max_range'] && $var > $args['max_range'] ) {
+		return $args['default'];
+	}
+
+	// $var is a valid integer.
+	return $var;
+}
+
+/**
  * Delete a file
  *
  * @since 4.2.0
diff --git tests/phpunit/tests/functions.php tests/phpunit/tests/functions.php
index 5f4d6fd..67d29fa 100644
--- tests/phpunit/tests/functions.php
+++ tests/phpunit/tests/functions.php
@@ -898,4 +898,81 @@ class Tests_Functions extends WP_UnitTestCase {
 		$unique_uuids = array_unique( $uuids );
 		$this->assertEquals( $uuids, $unique_uuids );
 	}
+
+	/**
+	 * Tests wp_validate_integer().
+	 *
+	 * @covers wp_validate_integer()
+	 * @ticket 39053
+	 */
+	function test_wp_validate_integer() {
+		// Various tests to generate a 4.
+		$expected = 4;
+
+		$actual = wp_validate_integer( 4 );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( '4' );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( 1 + '3' );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( 'Six', array( 'default' => 4 ) );
+		$this->assertSame( $expected, $actual );
+
+		// Various tests to generate a -4.
+		$expected = -4;
+
+		$actual = wp_validate_integer( -4 );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( '-4' );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( 1 - '5' );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( 'Six', array( 'default' => -4 ) );
+		$this->assertSame( $expected, $actual );
+
+		// Various tests for invalid data.
+		$expected = false;
+
+		$actual = wp_validate_integer( 4.2 );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( -4.2 );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( '4.2' );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( '-4.2' );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( array( 'no_args' => 'here' ) );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( -200, array(
+			'min_range' => 1,
+		) );
+		$this->assertSame( $expected, $actual );
+
+		$actual = wp_validate_integer( 200, array(
+			'max_range' => 1,
+		) );
+		$this->assertSame( $expected, $actual );
+
+		// Odd defaults
+		$actual = wp_validate_integer( 'WCUS Contributor Day', array(
+			'default' => array(),
+		) );
+		$this->assertSame( array(), $actual );
+
+		$actual = wp_validate_integer( 'WCUS Contributor Day', array(
+			'default' => 'Twenty Sixteen',
+		) );
+		$this->assertSame( 'Twenty Sixteen', $actual );
+	}
 }
