HEX
Server: nginx/1.28.1
System: Linux VM-0-12-opencloudos 6.6.117-45.oc9.x86_64 #1 SMP Thu Dec 4 10:26:39 CST 2025 x86_64
User: www (1000)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/lib/compat/plugin/fonts.php
<?php
/**
 * A special compat layer for legacy font files upload directory.
 *
 * @see https://github.com/WordPress/gutenberg/pull/57688#issuecomment-2259037546
 *
 * @package gutenberg
 */

// @core-merge: Do not merge this function, it is for deleting fonts from the wp-content/fonts directory only used in Gutenberg.
/**
 * Deletes associated font files from wp-content/fonts, when a font face is deleted.
 *
 * @param int     $post_id Post ID.
 * @param WP_Post $post    Post object.
 */
function gutenberg_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 );

	if ( empty( $font_files ) ) {
		return;
	}

	$site_path = '';
	if ( is_multisite() && ! ( is_main_network() && is_main_site() ) ) {
		$site_path = '/sites/' . get_current_blog_id();
	}

	$font_dir = path_join( WP_CONTENT_DIR, 'fonts' ) . $site_path;

	foreach ( $font_files as $font_file ) {
		$font_path = $font_dir . '/' . $font_file;

		if ( file_exists( $font_path ) ) {
			wp_delete_file( $font_path );
		}
	}
}
add_action( 'before_delete_post', 'gutenberg_before_delete_font_face', 10, 2 );