From 2e7eb7070b8470844488909c25f6f52a726451ee Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Mon, 28 Apr 2025 20:51:28 +0000 Subject: [PATCH] Query: Avoid unnecessary database query when deleting a font family. Querying only the font face IDs is sufficient when deleting a font family. There is no need to warm the caches with the full objects, since `wp_delete_post()` will always make a direct database query to get the object anyway. Props dilipbheda. Fixes #63014. Built from https://develop.svn.wordpress.org/trunk@60203 git-svn-id: http://core.svn.wordpress.org/trunk@59539 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/fonts.php | 7 ++++--- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/fonts.php b/wp-includes/fonts.php index 88495fc44a..3a76993008 100644 --- a/wp-includes/fonts.php +++ b/wp-includes/fonts.php @@ -219,15 +219,16 @@ function _wp_after_delete_font_family( $post_id, $post ) { return; } - $font_faces = get_children( + $font_faces_ids = get_children( array( 'post_parent' => $post_id, 'post_type' => 'wp_font_face', + 'fields' => 'ids', ) ); - foreach ( $font_faces as $font_face ) { - wp_delete_post( $font_face->ID, true ); + foreach ( $font_faces_ids as $font_faces_id ) { + wp_delete_post( $font_faces_id, true ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 6317ef70b1..a455ed50bf 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-60198'; +$wp_version = '6.9-alpha-60203'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.