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
This commit is contained in:
Felix Arntz
2025-04-28 20:51:28 +00:00
parent 4ef79cb3a5
commit 2e7eb7070b
2 changed files with 5 additions and 4 deletions

View File

@@ -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 );
}
}

View File

@@ -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.