Uses
Uses | Description |
---|---|
wp-includes/formatting.php: trailingslashit() | Appends a trailing slash. |
wp-includes/load.php: is_wp_error() | Check whether variable is a WordPress Error. |
Delete the old theme during an upgrade.
Hooked to the ‘upgrader_clear_destination’ filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().
(bool) (Required)
(string) (Required)
(string) (Required)
(array) (Required)
(bool)
File: wp-admin/includes/class-theme-upgrader.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; }
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/theme_upgrader/delete_old_theme