Make WordPress Core

Changeset 60203


Ignore:
Timestamp:
04/28/2025 08:49:19 PM (10 months ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/fonts.php

    r59286 r60203  
    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}
Note: See TracChangeset for help on using the changeset viewer.