Index: wp-includes/option.php
===================================================================
--- wp-includes/option.php	(revision 60707)
+++ wp-includes/option.php	(working copy)
@@ -1634,9 +1634,14 @@
  *
  * @global wpdb $wpdb WordPress database abstraction object.
  *
- * @param bool $force_db Optional. Force cleanup to run against the database even when an external object cache is used.
+ * @param bool        $force_db Optional. Force cleanup to run against the database even when an external object cache is used.
+ *                              Default false.
+ * @param string|bool $name     Optional. Transient name or prefix. If provided, only expired transients
+ *                              matching this name or prefix will be deleted. Default false.
  */
-function delete_expired_transients( $force_db = false ) {
+function delete_expired_transients( $force_db = false, $name = false ) {
 	global $wpdb;
 
 	if ( ! $force_db && wp_using_ext_object_cache() ) {
@@ -1643,6 +1648,9 @@
 		return;
 	}
 
+	$transient_like = $wpdb->esc_like( '_transient_' . ( $name ? $name : '' ) ) . '%';
+	$timeout_like   = $wpdb->esc_like( '_transient_timeout_' ) . '%';
+
 	$wpdb->query(
 		$wpdb->prepare(
 			"DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b
@@ -1650,8 +1658,8 @@
 			AND a.option_name NOT LIKE %s
 			AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
 			AND b.option_value < %d",
-			$wpdb->esc_like( '_transient_' ) . '%',
-			$wpdb->esc_like( '_transient_timeout_' ) . '%',
+			$transient_like,
+			$timeout_like,
 			time()
 		)
 	);
@@ -1659,6 +1667,9 @@
 	if ( ! is_multisite() ) {
+		$site_transient_like = $wpdb->esc_like( '_site_transient_' . ( $name ? $name : '' ) ) . '%';
+		$site_timeout_like   = $wpdb->esc_like( '_site_transient_timeout_' ) . '%';
+
 		// Single site stores site transients in the options table.
 		$wpdb->query(
 			$wpdb->prepare(
@@ -1667,8 +1678,8 @@
 				AND a.option_name NOT LIKE %s
 				AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
 				AND b.option_value < %d",
-				$wpdb->esc_like( '_site_transient_' ) . '%',
-				$wpdb->esc_like( '_site_transient_timeout_' ) . '%',
+				$site_transient_like,
+				$site_timeout_like,
 				time()
 			)
 		);
@@ -1676,6 +1687,9 @@
 	} elseif ( is_main_site() && is_main_network() ) {
+		$site_transient_like = $wpdb->esc_like( '_site_transient_' . ( $name ? $name : '' ) ) . '%';
+		$site_timeout_like   = $wpdb->esc_like( '_site_transient_timeout_' ) . '%';
+
 		// Multisite stores site transients in the sitemeta table.
 		$wpdb->query(
 			$wpdb->prepare(
@@ -1684,8 +1698,8 @@
 				AND a.meta_key NOT LIKE %s
 				AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )
 				AND b.meta_value < %d",
-				$wpdb->esc_like( '_site_transient_' ) . '%',
-				$wpdb->esc_like( '_site_transient_timeout_' ) . '%',
+				$site_transient_like,
+				$site_timeout_like,
 				time()
 			)
 		);
