wpseek.com
WordPress开发者和主题制作者的搜索引擎



_wp_before_delete_font_face › WordPress Function

Since6.5.0
已弃用n/a
_wp_before_delete_font_face ( $post_id, $post )
访问:
  • private
参数: (2)
  • (int) $post_id Post ID.
    Required: Yes
  • (WP_Post) $post Post object.
    Required: Yes
定义在:
文档:

Deletes associated font files when a font face is deleted.



源码

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 );
	}
}