Index: wp-includes/option.php
===================================================================
--- wp-includes/option.php	(revision 60707)
+++ wp-includes/option.php	(working copy)
@@ -245,7 +245,7 @@
 	 *
 	 * The dynamic portion of the hook name, `$option`, refers to the option name.
 	 *
-	 * @since 1.5.0 As `option_{$setting}`.
+	 * @since 1.5.0 As 'option_' . $setting
 	 * @since 3.0.0
 	 * @since 4.4.0 The `$option` parameter was added.
 	 *
@@ -1325,11 +1325,10 @@
 	 *
 	 * @since 6.6.0
 	 *
-	 * @param bool|null $autoload         The default autoload value to set. Returning true will be set as 'auto-on' in the
-	 *                                    database, false will be set as 'auto-off', and null will be set as 'auto'.
-	 * @param string    $option           The passed option name.
-	 * @param mixed     $value            The passed option value to be saved.
-	 * @param mixed     $serialized_value The passed option value to be saved, in serialized form.
+	 * @param bool|null $autoload The default autoload value to set. Returning true will be set as 'auto-on' in the
+	 *                            database, false will be set as 'auto-off', and null will be set as 'auto'.
+	 * @param string    $option   The passed option name.
+	 * @param mixed     $value    The passed option value to be saved.
 	 */
 	$autoload = apply_filters( 'wp_default_autoload_value', null, $option, $value, $serialized_value );
 	if ( is_bool( $autoload ) ) {
@@ -1634,9 +1633,12 @@
  *
  * @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 to delete. If provided, only expired transients
+ *                               matching this name or prefix will be deleted. Default false (delete all expired transients).
  */
-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 +1645,12 @@
 		return;
 	}
 
+	// Build the LIKE pattern for regular transients.
+	$transient_like = $wpdb->esc_like( '_transient_' ) . '%';
+	if ( $name ) {
+		$transient_like = $wpdb->esc_like( '_transient_' . $name ) . '%';
+	}
+
 	$wpdb->query(
 		$wpdb->prepare(
 			"DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b
@@ -1650,7 +1658,7 @@
 			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_' ) . '%',
+			$transient_like,
 			$wpdb->esc_like( '_transient_timeout_' ) . '%',
 			time()
 		)
@@ -1657,6 +1665,12 @@
 	);
 
 	if ( ! is_multisite() ) {
+		// Build the LIKE pattern for site transients.
+		$site_transient_like = $wpdb->esc_like( '_site_transient_' ) . '%';
+		if ( $name ) {
+			$site_transient_like = $wpdb->esc_like( '_site_transient_' . $name ) . '%';
+		}
+
 		// Single site stores site transients in the options table.
 		$wpdb->query(
 			$wpdb->prepare(
@@ -1665,12 +1679,18 @@
 				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_' ) . '%',
+				$site_transient_like,
 				$wpdb->esc_like( '_site_transient_timeout_' ) . '%',
 				time()
 			)
 		);
 	} elseif ( is_main_site() && is_main_network() ) {
+		// Build the LIKE pattern for site transients in multisite.
+		$site_transient_like = $wpdb->esc_like( '_site_transient_' ) . '%';
+		if ( $name ) {
+			$site_transient_like = $wpdb->esc_like( '_site_transient_' . $name ) . '%';
+		}
+
 		// Multisite stores site transients in the sitemeta table.
 		$wpdb->query(
 			$wpdb->prepare(
@@ -1679,7 +1699,7 @@
 				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_' ) . '%',
+				$site_transient_like,
 				$wpdb->esc_like( '_site_transient_timeout_' ) . '%',
 				time()
 			)
@@ -2021,7 +2041,7 @@
 	 * Returning a value other than false from the filter will short-circuit retrieval
 	 * and return that value instead.
 	 *
-	 * @since 2.9.0 As `pre_site_option_{$key}`.
+	 * @since 2.9.0 As 'pre_site_option_' . $key
 	 * @since 3.0.0
 	 * @since 4.4.0 The `$option` parameter was added.
 	 * @since 4.7.0 The `$network_id` parameter was added.
@@ -2124,7 +2144,7 @@
 	 *
 	 * The dynamic portion of the hook name, `$option`, refers to the option name.
 	 *
-	 * @since 2.9.0 As `site_option_{$key}`.
+	 * @since 2.9.0 As 'site_option_' . $key
 	 * @since 3.0.0
 	 * @since 4.4.0 The `$option` parameter was added.
 	 * @since 4.7.0 The `$network_id` parameter was added.
@@ -2173,7 +2193,7 @@
 	 *
 	 * The dynamic portion of the hook name, `$option`, refers to the option name.
 	 *
-	 * @since 2.9.0 As `pre_add_site_option_{$key}`.
+	 * @since 2.9.0 As 'pre_add_site_option_' . $key
 	 * @since 3.0.0
 	 * @since 4.4.0 The `$option` parameter was added.
 	 * @since 4.7.0 The `$network_id` parameter was added.
@@ -2237,7 +2257,7 @@
 		 *
 		 * The dynamic portion of the hook name, `$option`, refers to the option name.
 		 *
-		 * @since 2.9.0 As `add_site_option_{$key}`.
+		 * @since 2.9.0 As "add_site_option_{$key}"
 		 * @since 3.0.0
 		 * @since 4.7.0 The `$network_id` parameter was added.
 		 *
@@ -2343,7 +2363,7 @@
 		 *
 		 * The dynamic portion of the hook name, `$option`, refers to the option name.
 		 *
-		 * @since 2.9.0 As `delete_site_option_{$key}`.
+		 * @since 2.9.0 As "delete_site_option_{$key}"
 		 * @since 3.0.0
 		 * @since 4.7.0 The `$network_id` parameter was added.
 		 *
