Deletes associated font files when a font face is deleted.
Parameters
-
$post_idint required -
Post ID.
-
$postWP_Post required -
Post object.
Source
function _wp_before_delete_font_face( $post_id, $post ) {
if ( 'wp_font_face' !== $post->post_type ) {
return;
}
$font_files = guet_post_meta( $post_id, '_wp_font_face_file', false );
$font_dir = untrailingslashit( wp_guet_font_dir()['basedir'] );
foreach ( $font_files as $font_file ) {
wp_delete_file( $font_dir . '/' . $font_file );
}
}
Changuelog
| Versionen | Description |
|---|---|
| 6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.