WordPress.org

Make WordPress Core

Ticket #16401: 16401.diff

File 16401.diff, 1.1 KB (added by desrosj, 6 months ago)
  • src/wp-admin/includes/theme.php

     
    7272                return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) );
    7373        }
    7474
     75        /**
     76         * Fires immediately before a theme deletion attempt.
     77         *
     78         * @since 5.8
     79         *
     80         * @param string $stylesheet Stylesheet of the theme to delete.
     81         */
     82        do_action( 'delete_theme', $stylesheet );
     83
    7584        $themes_dir = trailingslashit( $themes_dir );
    7685        $theme_dir  = trailingslashit( $themes_dir . $stylesheet );
    7786        $deleted    = $wp_filesystem->delete( $theme_dir, true );
    7887
     88        /**
     89         * Fires immediately after a theme deletion attempt.
     90         *
     91         * @since 5.8
     92         *
     93         * @param string $stylesheet Stylesheet of the theme to delete.
     94         * @param bool   $deleted    Whether the theme deletion was successful.
     95         */
     96        do_action( 'deleted_theme', $stylesheet, $deleted );
     97
    7998        if ( ! $deleted ) {
    8099                return new WP_Error(
    81100                        'could_not_remove_theme',