WordPress.org

Make WordPress Core

Ticket #51861: patch.diff

File patch.diff, 744 bytes (added by martin.krcho, 7 months ago)

Patch introducing deleted_theme action

  • wp-admin/includes/theme.php

    diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
    index f11a6fc234..556657cab5 100644
    a b function delete_theme( $stylesheet, $redirect = '' ) { 
    7676        $theme_dir  = trailingslashit( $themes_dir . $stylesheet );
    7777        $deleted    = $wp_filesystem->delete( $theme_dir, true );
    7878
     79        /**
     80         * Fires immediately after a theme deletion attempt.
     81         *
     82         * @since 5.6.0
     83         *
     84         * @param string $stylesheet  Stylesheet of the theme to delete.
     85         * @param bool   $deleted     Whether the theme deletion was successful.
     86         */
     87        do_action( 'deleted_theme', $stylesheet, $deleted );
     88       
    7989        if ( ! $deleted ) {
    8090                return new WP_Error(
    8191                        'could_not_remove_theme',