Skip to content

Commit d985e8f

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@60203 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b2b7162 commit d985e8f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/wp-includes/fonts.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,16 @@ function _wp_after_delete_font_family( $post_id, $post ) {
219219
return;
220220
}
221221

222-
$font_faces = get_children(
222+
$font_faces_ids = get_children(
223223
array(
224224
'post_parent' => $post_id,
225225
'post_type' => 'wp_font_face',
226+
'fields' => 'ids',
226227
)
227228
);
228229

229-
foreach ( $font_faces as $font_face ) {
230-
wp_delete_post( $font_face->ID, true );
230+
foreach ( $font_faces_ids as $font_faces_id ) {
231+
wp_delete_post( $font_faces_id, true );
231232
}
232233
}
233234

0 commit comments

Comments
 (0)