wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_wp_before_delete_font_face › WordPress Function

Seit6.5.0
Veraltetn/v
_wp_before_delete_font_face ( $post_id, $post )
Zugriff:
  • private
Parameter: (2)
  • (int) $post_id Post ID.
    Erforderlich: Ja
  • (WP_Post) $post Post object.
    Erforderlich: Ja
Definiert in:
Codex:

Deletes associated font files when a font face is deleted.



Quellcode

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

	$font_files = get_post_meta( $post_id, '_wp_font_face_file', false );
	$font_dir   = wp_get_font_dir()['path'];

	foreach ( $font_files as $font_file ) {
		wp_delete_file( $font_dir . '/' . $font_file );
	}
}