Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete a new theme cloned using the subfolder option #500

Open
Olein-jp opened this issue Dec 26, 2023 · 8 comments
Open

Cannot delete a new theme cloned using the subfolder option #500

Olein-jp opened this issue Dec 26, 2023 · 8 comments

Comments

@Olein-jp
Copy link
Contributor

Environment

WordPress: 6.4.2
Create Block Theme: 1.13.8

Details

From the Create Block Theme panel of the site editor, enter any text in the subfolder and clone the theme.

The theme will then be activated automatically, but if you try to remove the theme after it has been deactivated, an error will occur.

I tested the following flow.

  1. select Create Block in the Create Block Theme panel in the site editor
  2. Fill in the required information and click Clone Theme.

image

  1. The cloned theme will be activated automatically. We can see a message "Theme cloned successfully. The editor will now reload."
  2. Activate another block theme (disable the cloned theme)
  3. Delete the disabled cloned theme from Theme in Appearance

image

  1. Error message is displayed and cannot delete. We can see a message "Deletion failed: The requested theme does not exist.".

image

Inside of wp-content/themes/ is like this. Didn't remove subfolder and cloned theme folder.

screenshot

Of course, this can be handled by accessing the Themes folder and deleting the corresponding folder manually, but this is inconvenient.

@t-hamano
Copy link
Contributor

Fundamentally, it's probably a WP core issue where we can't delete themes installed in the subdirectory. In other words, it's a problem with the delete_theme() function.

However, I am wondering whether a theme placed in a subdirectory should be considered an installed/enabled theme.

I have submitted a ticket with Core regarding this question: https://core.trac.wordpress.org/ticket/60248

@Olein-jp
Copy link
Contributor Author

@t-hamano Thank you for creating ticket for core. Should I close this issue as it will be discussed in the core ticket in the future?

@t-hamano
Copy link
Contributor

Should I close this issue as it will be discussed in the core ticket in the future?

Personally, I think it's better to leave this issue open.

If it is not the intended behavior that themes placed in the subsubfolder directory are also recognized, this should be fixed in the core.

If such changes are made in the core, it may be necessary to remove the subfolder field in this plugin. This is because a theme that has been duplicated by specifying a subfolder cannot be deleted from the theme list page.

I think it's better to leave this issue open to consider whether the subfolder option should remain or be removed.

@Olein-jp
Copy link
Contributor Author

I agree with you. I'll keep this issue open. Thank you.

@pbking
Copy link
Contributor

pbking commented Apr 29, 2024

My workflow (working in a folder managed by git) requires that themes I create be created in (or relocated to) a separate folder. I would lose a lot of functionality if I were unable to do this.

I don't think that there's anything this plugin can to do better support themes created in folders, and I definitely feel that the plugin should be able to continue doing this. I believe we should close this issue as something that should be addressed exclusively in core.

@t-hamano
Copy link
Contributor

t-hamano commented May 1, 2024

Even if this option is useful for certain use cases and should be improved in the core, the core does not allow us to upload themes to subfolders via the UI. In other words, if you are a typical user, you will not normally encounter the problem of not being able to delete a theme.

On the other hand, the subfolder option is available to anyone with access to the Site Editor. If you want to delete a theme installed in a subfolder, you will need to access the server and delete that folder. However, since there is no mention anywhere that this needs to be done, I think there is a high possibility that it will be recognized as a bug.
Delete the subfolder field.
In the Subfolder field, add a note that the theme must be deleted manually.
Add functionality to delete themes installed in subfolders.

I would like to suggest implementing one of the following approaches:

  • Delete the subfolder field.
  • Below the subfolder field, add a note that the theme must be deleted manually.
  • Add functionality to delete themes installed in subfolders.

@pbking
Copy link
Contributor

pbking commented May 1, 2024

It's currently possible for somebody to move the theme out of a subfolder (by clearing the subfolder field in the metadata form and saving). Then the theme could be deleted in the normal ways. Noting that (or that it would need to be deleted manually) at the subfolder field would be helpful. Access to the server wouldn't be required in that workflow.

@t-hamano
Copy link
Contributor

t-hamano commented May 1, 2024

Oh, I didn't know we could move a theme in a subfolder out of the subfolder. If so, I think adding some kind of annotation to the field is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants