WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Theme_Upgrader::delete_old_theme() public WP 2.8.0

Delete the old theme during an upgrade.

Hooked to the 'upgrader_clear_destination' filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().

Это метод класса: Theme_Upgrader{}

Хуков нет.

Возвращает

true/false.

Использование

$Theme_Upgrader = new Theme_Upgrader();
$Theme_Upgrader->delete_old_theme( $removed, $local_destination, $remote_destination, $theme );
$removed(true/false) (обязательный)
$local_destination(строка) (обязательный)
$remote_destination(строка) (обязательный)
$theme(массив) (обязательный)

Заметки

  • Global. WP_Filesystem_Base. $wp_filesystem Subclass

Список изменений

С версии 2.8.0 Введена.

Код Theme Upgrader::delete old theme: wp-admin/includes/class-theme-upgrader.php WP 5.5.1

<?php
public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
	global $wp_filesystem;

	if ( is_wp_error( $removed ) ) {
		return $removed; // Pass errors through.
	}

	if ( ! isset( $theme['theme'] ) ) {
		return $removed;
	}

	$theme      = $theme['theme'];
	$themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) );
	if ( $wp_filesystem->exists( $themes_dir . $theme ) ) {
		if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) {
			return false;
		}
	}

	return true;
}