WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 3 weeks ago

#51832 new enhancement

Add a more visible way to delete unused themes

Reported by: tobifjellner Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.5
Component: Themes Keywords: needs-design needs-screenshots dev-feedback
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 (1)

#51832.patch (4.6 KB) - added by 9primus 9 months 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

Download all attachments as: .zip

Change History (12)

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


11 months ago

#2 @9primus
10 months 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.


9 months ago

#4 @paaljoachim
9 months 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
9 months 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
9 months 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;
}
Version 0, edited 9 months ago by 9primus (next)

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


9 months ago

#7 @SergeyBiryukov
9 months 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
5 months 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
5 months 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 months ago

#53796 was marked as a duplicate.

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


3 weeks ago

Note: See TracTickets for help on using tickets.