Index: src/wp-includes/functions.php
===================================================================
--- src/wp-includes/functions.php	(revision 40041)
+++ src/wp-includes/functions.php	(working copy)
@@ -832,6 +832,53 @@
 }
 
 /**
+ * Gets an item or items from a query string.
+ *
+ * @since 4.8.0
+ *
+ * @param string|array $key   Query key or keys to get.
+ * @param bool|string  $query Optional. When false uses the current URL. Default false.
+ * @return string|null|array Value for the key or null, or an associative  array of keys and
+ *                           their values if $key is an array.
+ */
+function get_query_arg( $key, $query = false ) {
+	if ( false === $query ) {
+		$query = $_SERVER['REQUEST_URI'];
+	}
+
+	$query_string = parse_url( $query, PHP_URL_QUERY );
+	if ( ! $query_string ) {
+		if ( is_array( $key ) ) {
+			return array_combine( $key, array_fill( 0, count( $key ), null ) );
+		}
+
+		return null;
+	}
+
+	parse_str( $query_string, $query_args );
+
+	if ( is_array( $key ) ) {
+		$results = array();
+
+		foreach ( $key as $k ) {
+			if ( isset( $query_args[ $k ] ) ) {
+				$results[ $k ] = $query_args[ $k ];
+			} else {
+				$results[ $k ] = null;
+			}
+		}
+
+		return $results;
+	}
+
+	if ( ! isset( $query_args[ $key ] ) ) {
+		return null;
+	}
+
+	return $query_args[ $key ];
+}
+
+/**
  * Removes an item or items from a query string.
  *
  * @since 1.5.0
