Index: src/wp-includes/link-template.php
--- src/wp-includes/link-template.php
+++ src/wp-includes/link-template.php
@@ -7,6 +7,86 @@
  */
 
 /**
+ * Generate a URL by provding a set of query parameters to add or remove. Also
+ * accepts a few other optional arguments for escaping and echoing the results
+ *
+ * @see build_query()
+ * @see _html_build_query()
+ *
+ * @since 4.3.0
+ *
+ * @param array $args {
+ *     Optional. Default URL arguments. Default empty array.
+ *
+ *     @type array   $add_query_args    'key' => 'value' array of arguments to add
+ *     @type array   $remove_query_args 'key' => 'value' array of arguments to remove
+ *     @type string  $url                Original URL to generate new URL from
+ *     @type boolean $escape             True|False. Will run `esc_url()` on generated URL
+ *     @type boolean $echo               True|False. Will echo *escaped* generated URL before returning
+ * }
+ * @return string The generated URL based on arguments passed into $args param
+ */
+function wp_generate_url( $args = array() ) {
+
+	// Grab the `home_url()` to use as the default URL if none is passed
+	$home_url = home_url();
+
+	// Parse passed arguments with default arguments
+	$r = wp_parse_args( $args, array(
+		'add_query_args'    => array(),
+		'remove_query_args' => array(),
+		'url'               => $home_url,
+		'escape'            => true,
+		'echo'              => false
+	) );
+
+	// URL has not been escaped yet
+	$escaped = false;
+
+	// Ensure there is always a URL, even if it's not exactly what was intended
+	// by the developer using this function. This is intended to guarantee a
+	// somewhat sane and anticipated URL is returned.
+	$generated_url = ! empty( $r['url'] )
+		? $r['url']
+		: $home_url;
+
+	// Add any query arguments
+	if ( ! empty( $r['add_query_args'] ) ) {
+		$generated_url = add_query_arg( $r['add_query_args'], $generated_url );
+	}
+
+	// Remove any query arguments
+	if ( ! empty( $r['remove_query_args'] ) ) {
+		$generated_url = remove_query_arg( $r['remove_query_args'], $generated_url );
+	}
+
+	// Filter the generated result, and pass along all of our known variables
+	$retval = apply_filters( 'wp_generate_url', $generated_url, $r, $args );
+
+	// Maybe prepare the results for output to the browser
+	if ( true === $r['escape'] ) {
+		$retval  = esc_url( $retval );
+		$escaped = true;
+	}
+
+	// Maybe echo the result to the browser
+	if ( true === $r['echo'] ) {
+
+		// Always escape URLs before echo'ing
+		if ( false === $escaped ) {
+			$retval  = esc_url( $retval );
+			$escaped = true;
+		}
+
+		// Echo *escaped* URL to the browser
+		echo $retval;
+	}
+
+	// Return the generated result
+	return $retval;
+}
+
+/**
  * Display the permalink for the current post.
  *
  * @since 1.2.0
