diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 94f7371..42606c1 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -4762,3 +4762,36 @@ function wp_validate_boolean( $var ) {
 
 	return (bool) $var;
 }
+
+/**
+ * Check if any number of constants are defined and true.
+ *
+ * e.g. wp_check_constants( array( 'DOING_AJAX', 'DOING_AUTOSAVE' ) )
+ *
+ * @since  4.1.0
+ *
+ * @param  string|array $constants Constant(s) to test.
+ * @return bool True if all provided constants are defined and true, otherwise false.
+ */
+function wp_check_constants( $constants = '' ) {
+	foreach( (array) $constants as $constant ) {
+		if ( ! is_constant_true( $constant ) ) {
+			return false;
+		}
+	}
+
+	return true;
+}
+
+/**
+ * Check if a constant is defined and true.
+ *
+ * @since  4.1.0
+ *
+ * @param  string $constants Constant to test.
+ * @return bool              True if constant is defined and true, otherwise false.
+ */
+function is_constant_true( $constant = '' ) {
+	$constant = strtoupper( $constant );
+	return defined( $constant ) && true === constant( $constant );
+}
diff --git tests/phpunit/tests/post.php tests/phpunit/tests/post.php
index 7334fe2..7f9cbda 100644
--- tests/phpunit/tests/post.php
+++ tests/phpunit/tests/post.php
@@ -991,4 +991,42 @@ class Tests_Post extends WP_UnitTestCase {
 		_unregister_taxonomy( $tax );
 	}
 
+	/**
+	 * @ticket 30188
+	 */
+	function test_is_constant_true_true() {
+		define( 'TEST_IS_CONSTANT_TRUE_TRUE', true );
+		$expected = is_constant_true( 'TEST_IS_CONSTANT_TRUE_TRUE' );
+		$this->assertTrue( $expected );
+	}
+
+	/**
+	 * @ticket 30188
+	 */
+	function test_is_constant_true_false() {
+		define( 'TEST_IS_CONSTANT_TRUE_FALSE', false );
+		$expected = is_constant_true( 'TEST_IS_CONSTANT_TRUE_FALSE' );
+		$this->assertFalse( $expected );
+	}
+
+	/**
+	 * @ticket 30188
+	 */
+	function test_wp_check_constants_true() {
+		define( 'TEST_WP_CHECK_CONSTANTS_TRUE_A', true );
+		define( 'TEST_WP_CHECK_CONSTANTS_TRUE_B', true );
+		$expected = wp_check_constants( array( 'TEST_WP_CHECK_CONSTANTS_TRUE_A', 'TEST_WP_CHECK_CONSTANTS_TRUE_B' ) );
+		$this->assertTrue( $expected );
+	}
+
+	/**
+	 * @ticket 30188
+	 */
+	function test_wp_check_constants_false() {
+		define( 'TEST_WP_CHECK_CONSTANTS_FALSE_A', true );
+		define( 'TEST_WP_CHECK_CONSTANTS_FALSE_B', false );
+		$expected = wp_check_constants( array( 'TEST_WP_CHECK_CONSTANTS_FALSE_A', 'TEST_WP_CHECK_CONSTANTS_FALSE_B' ) );
+		$this->assertFalse( $expected );
+	}
+
 }
