_wp_after_delete_font_family()WP 6.5.0

Deletes child font faces when a font family is deleted.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Returns

null. Nothing (null).

Usage

_wp_after_delete_font_family( $post_id, $post );
$post_id(int) (required)
Post ID.
$post(WP_Post) (required)
Post object.

Changelog

Since 6.5.0 Introduced.

_wp_after_delete_font_family() code WP 7.0

function _wp_after_delete_font_family( $post_id, $post ) {
	if ( 'wp_font_family' !== $post->post_type ) {
		return;
	}

	$font_faces_ids = get_children(
		array(
			'post_parent' => $post_id,
			'post_type'   => 'wp_font_face',
			'fields'      => 'ids',
		)
	);

	foreach ( $font_faces_ids as $font_faces_id ) {
		wp_delete_post( $font_faces_id, true );
	}
}