• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Theme_Upgrader::delete_old_theme() – Delete the old theme during an upgrade.

You appear to be a bot. Output may be restricted

Description

Delete the old theme during an upgrade.

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

Usage

$bool = Theme_Upgrader::delete_old_theme( $removed, $local_destination, $remote_destination, $theme );

Parameters

$removed
( bool ) required –
$local_destination
( string ) required –
$remote_destination
( string ) required –
$theme
( array ) required –

Returns

bool

Source

File name: wordpress/wp-admin/includes/class-theme-upgrader.php
Lines:

1 to 21 of 21
  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;
  }
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: Theme_Upgrader::delete_old_theme
Class ref: Theme_Upgrader
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-admin/includes/class-theme-upgrader.php
File ref: wp-admin/includes/class-theme-upgrader.php
Deprecated?: No
API Letters: D,O,T,U

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites