WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 6 months ago

#14955 new enhancement

Themes should support uninstall.php or uninstall hook — at Version 2

Reported by: WraithKenny Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

Related tickets on extending Themes to have Plugin features: #7795 and #14849 but those deal primarily with activation and deactivation centering around 'switch_themes' action.

From looking at /wp-admin/includes/plugin.php, adding support for uninstall is a separate concern (and it doesn't have the issue blocking activation/deactivation).

Should is_uninstallable_plugin, register_uninstall_hook and uninstall_plugin be extended to check theme directory or should versions (is_uninstallable_theme, register_uninstall_theme_hook and uninstall_theme) be added to theme.php?

Advantage of the first method is that the register_uninstall_hook could be reused for Themes where in the second, a new, less attractive name would be needed (register_uninstall_theme_hook?) Also, there's no theme_basename as it was reverted/removed.

Change History (2)

comment:1 @scribu5 years ago

We shouldn't attempt to reuse register_*_hook() functions because there's only one theme running at a time, so the underlying logic would be very different.

That's why there's no theme_basename() and why the $file parameter wouldn't be needed.

comment:2 @scribu5 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.