Commit b73c8070f1 for wordpress.org

commit b73c8070f1219b0073853856efa6e68e0c114e82
Author: westonruter <westonruter@git.wordpress.org>
Date:   Fri Sep 18 02:21:49 2026 +0000

    General: Hoist option lookups out of `wp_get_archives()` loops.

    The `daily` and `weekly` branches called `get_option()` once per result row, and each call runs the option filters even when `alloptions` is warm. Read `date_format` and `start_of_week` once before the loop instead, keeping their original evaluation order so the filters still fire in the same sequence.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13580.
    Follow-up to r37005.

    Props mukesh27.
    See #36243.
    Fixes #66128.

    Built from https://develop.svn.wordpress.org/trunk@63757


    git-svn-id: http://core.svn.wordpress.org/trunk@62929 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 0e35894fd4..2f37fbae50 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -2414,14 +2414,15 @@ function wp_get_archives( $args = '' ) {
 			wp_cache_set_salted( $key, $results, 'post-queries', $last_changed );
 		}
 		if ( $results ) {
-			$after = $parsed_args['after'];
+			$after       = $parsed_args['after'];
+			$date_format = get_option( 'date_format' );
 			foreach ( (array) $results as $result ) {
 				$url = get_day_link( $result->year, $result->month, $result->dayofmonth );
 				if ( 'post' !== $parsed_args['post_type'] ) {
 					$url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
 				}
 				$date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth );
-				$text = mysql2date( get_option( 'date_format' ), $date );
+				$text = mysql2date( $date_format, $date );
 				if ( $parsed_args['show_post_count'] ) {
 					$parsed_args['after'] = '&nbsp;(' . $result->posts . ')' . $after;
 				}
@@ -2441,14 +2442,16 @@ function wp_get_archives( $args = '' ) {
 		}
 		$arc_w_last = '';
 		if ( $results ) {
-			$after = $parsed_args['after'];
+			$after         = $parsed_args['after'];
+			$start_of_week = get_option( 'start_of_week' );
+			$date_format   = get_option( 'date_format' );
 			foreach ( (array) $results as $result ) {
 				if ( $result->week !== $arc_w_last ) {
 					$arc_year       = $result->yr;
 					$arc_w_last     = $result->week;
-					$arc_week       = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) );
-					$arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
-					$arc_week_end   = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
+					$arc_week       = get_weekstartend( $result->yyyymmdd, $start_of_week );
+					$arc_week_start = date_i18n( $date_format, $arc_week['start'] );
+					$arc_week_end   = date_i18n( $date_format, $arc_week['end'] );
 					$url            = add_query_arg(
 						array(
 							'm' => $arc_year,
diff --git a/wp-includes/version.php b/wp-includes/version.php
index c212ac43f5..1eb0d326fe 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-63756';
+$wp_version = '7.2-alpha-63757';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.