Make WordPress Core

Opened 3 years ago

Last modified 23 months ago

#51832 new enhancement

Add a more visible way to delete unused themes

Reported by: tobifjellner's profile tobifjellner Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.5
Component: Themes Keywords: needs-design dev-feedback has-screenshots
Focuses: ui, javascript, administration, rest-api, coding-standards Cc:

Description

Today (in WP 5.5) in order to delete a theme I don't use, I need to navigate to Appearance → Themes, then click on "Theme Details" that is only visible when a theme has focus and in the splash dialog, finally, hit "Delete".

Since the Health Check reminds users to remove themes they don't use, we systematically set people off looking for how to delete unused themes without finding (and then writing nervous posts in various help forums).

Let's add a more discoverable way!
On the "Themes" page, we could add a button at the top of the page (after the "Search installed themes" dialog) "Delete unused themes".
When you hit that button, you get a list of all your themes. Your current theme (and its parent theme, where applicable) would be inaccessible and "greyed out". All other themes would have selection boxes. At the top of the list there should be a two buttons: "Select all themes recommended for deletion" and "Delete selected themes".

Hmm. May words. Perhaps someone with suitable skills could draft a mock-up?

Attachments (5)

#51832.patch (4.6 KB) - added by 9primus 3 years ago.
Hello everyone. This is my patch for deleting multiple themes .Unfortunately it delete not all file in last version of wordpress. Plese , give me feedback about my patch
view-toggle.JPG (29.8 KB) - added by birgire 23 months ago.
Existing example of grid/list view from the Media library
themes-grid-view.jpg (101.5 KB) - added by birgire 23 months ago.
Themes Grid view
themes-list-view.jpg (101.3 KB) - added by birgire 23 months ago.
Themes List view with toggle buttons
themes-list-view-bulk-delete-markers.JPG (208.0 KB) - added by birgire 23 months ago.
suggestion of delete possibilities for Themes

Download all attachments as: .zip

Change History (19)

This ticket was mentioned in Slack in #forums by tobifjellner. View the logs.


3 years ago

#2 @9primus
3 years ago

  • Focuses ui javascript administration rest-api coding-standards added

Hello tobifjellner!) I think I can implement your enhancement. See you soon here.

This ticket was mentioned in Slack in #core by 9primus. View the logs.


3 years ago

#4 @paaljoachim
3 years ago

  • Keywords needs-screenshots added

Hi

Please upload a screenshot and perhaps also an animated gif when ready. Thanks.
As it would give us a visual idea what it looks like.

@9primus
3 years ago

Hello everyone. This is my patch for deleting multiple themes .Unfortunately it delete not all file in last version of wordpress. Plese , give me feedback about my patch

#5 @9primus
3 years ago

  • Keywords dev-feedback added

It seems this function from my patch not delete all files, please give me feedback:

<?php
function Delete($path)
{
    if (is_dir($path) === true)
    {
                $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);

        foreach ($files as $file)
        {
                        if ($file->isDir() === true)
                        {
                                rmdir($file->getPathName());
                        }

                        else if (($file->isFile() === true) || ($file->isLink() === true))
                        {
                                unlink($file->getPathname());
                        }
        }

        return rmdir($path);
    }

    else if ((is_file($path) === true) || (is_link($path) === true))
    {
        return unlink($path);
    }

    return false;
}
Last edited 3 years ago by 9primus (previous) (diff)

This ticket was mentioned in Slack in #core by sergey. View the logs.


3 years ago

#7 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.8

Hi @9primus, thanks for the patch! Moving to the milestone for visibility and review.

#8 @poena
3 years ago

  • Milestone changed from 5.8 to Future Release

Hi

I was not able to apply the patch.
I am not able to help answer your question but I can give you some small pieces of feedback and links to resources.

You do not need to include the changes to package-lock.json in the patch.

Do not leave unused, commented out code in the patch.

Make sure that the code is secure.
Here are some resources for learning about security:
https://developer.wordpress.org/plugins/security/
https://developer.wordpress.org/themes/theme-security/

Follow the WordPress coding standards.
https://developer.wordpress.org/coding-standards/wordpress-coding-standards/

Follow the naming conventions:
https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions

Make sure that all the text is wrapped in translation functions.
https://developer.wordpress.org/apis/handbook/internationalization/
https://make.wordpress.org/core/handbook/best-practices/internationalization/

Because there is not enough time to refresh and test the patch for this enhancement before the 5.8 feature freeze I am moving it to future release.

#9 @SergeyBiryukov
3 years ago

In addition to the above comment, the patch should use existing core functionality as much as possible, for example the delete_theme() function, instead of trying to reimplement it in another place.

Some screenshots with the patch applied would also be helpful.

#10 @SergeyBiryukov
3 years ago

#53796 was marked as a duplicate.

This ticket was mentioned in Slack in #core-themes by tobifjellner. View the logs.


3 years ago

#13 @sabernhardt
23 months ago

#55822 was marked as a duplicate.

@birgire
23 months ago

Existing example of grid/list view from the Media library

@birgire
23 months ago

Themes Grid view

@birgire
23 months ago

Themes List view with toggle buttons

@birgire
23 months ago

suggestion of delete possibilities for Themes

#14 @birgire
23 months ago

  • Keywords has-screenshots added; needs-screenshots removed

I posted similar screenshots in a related ticket #53523

I think a list table would be a suitable option here as there might be more actions needed in addition to delete (e.g. additionally update, enable auto-update, disable auto-update).

So such a table could extend the WP_List_Table class in a similar way the WP_MS_Themes_List_Table class does, rather than WP_Themes_List_Table.

There exists toggle buttons for the Media library that might be re-used as well.

Last edited 23 months ago by birgire (previous) (diff)
Note: See TracTickets for help on using tickets.