Make WordPress Core

Opened 14 years ago

Closed 4 years ago

Last modified 3 years ago

#16401 closed enhancement (fixed)

Add hook to delete_theme() on successful delete

Reported by: scottconnerly's profile scottconnerly Owned by: desrosj's profile desrosj
Milestone: 5.8 Priority: normal
Severity: normal Version: 2.8
Component: Themes Keywords: has-patch has-dev-note
Focuses: Cc:

Description (last modified by desrosj)

Add an action or filter to the end of /wp-admin/includes/theme.php delete_theme()'s processing when the write is successful.

The use case is for managing a WordPress install on an SVN-controlled server. Whenever the CMS changes a file or folder (particularly in the wp-content folder) I need to be able to trigger an svn commit.

See also Ticket #16396.

Attachments (2)

ticket.16401.diff (410 bytes) - added by ptahdunbar 14 years ago.
16401.diff (1.1 KB) - added by desrosj 4 years ago.

Download all attachments as: .zip

Change History (18)

#1 @scottconnerly
14 years ago

  • Cc scottconnerly added
  • Keywords subversion added

#2 in reply to: ↑ description @mikeschinkel
14 years ago

Replying to scottconnerly:

Add an action or filter to the end of /wp-admin/includes/theme.php delete_theme()'s processing when the write is successful.

The use case is for managing a Wordpress install on an SVN-controlled server. Whenever the CMS changes a file or folder (particularly in the wp-content folder) I need to be able to trigger an svn commit.

See also Ticket # 16396

+1

#3 @ptahdunbar
14 years ago

  • Cc trac@… added
  • Keywords has-patch added

ticket.16401.diff adds a new action 'deleted_theme' passing the $template variable as the first parameter.

#4 @obenland
12 years ago

  • Keywords close added; subversion removed

Can we close this in favor of #14955?

You could check the proposed action in the patched attached there. Also, playing with the 'delete_site_transient' action might solve your problem too.

#5 @obenland
12 years ago

  • Description modified (diff)

#7 @chriscct7
9 years ago

  • Keywords has-patch close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #14955.

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


9 years ago

@desrosj
4 years ago

#9 @desrosj
4 years ago

  • Description modified (diff)
  • Keywords has-patch added
  • Milestone set to 5.8
  • Resolution duplicate deleted
  • Status changed from closed to reopened

I'm reopening this as I feel #14955 is a bit different. That ticket aims to provide a way for the theme being deleted/uninstalled to clean up after itself. But this suggestion is more for a general action hook that would fire when a theme is deleted successfully.

Since an active theme cannot be deleted, it would not be possible for a theme to use these hooks for the purpose of cleanup.

delete_theme/deleted_theme theme hooks would also bring parity to the plugin deletion process.

16401.diff is a refresh of a patch from #14955 worked on by @pbiron and @vetyst that adds these hooks.

#10 @desrosj
4 years ago

  • Keywords commit added
  • Version changed from 3.0.4 to 2.8

Marking as 2.8, when delete_theme() was introduced.

#11 @desrosj
4 years ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from reopened to closed

In 50826:

Themes: Introduce the delete_theme and deleted_theme action hooks.

This change introduces the delete_theme and deleted_theme action hooks, which fire immediately before and after an attempt to delete a theme, respectively.

Props scottconnerly, ptahdunbar, pbiron, vetyst, desrosj.
Fixes #16401.

#12 @desrosj
4 years ago

In 50827:

Docs: Use correct @since tag notation.

This corrects the version number specified by the @since tag for the delete_theme and deleted_theme action hooks introduced in [50826] to contain a full, 3 digit version.

Props ocean90.
See #16401.

#13 @audrasjb
4 years ago

  • Keywords needs-dev-note added

#15 @sabernhardt
3 years ago

#37587 was marked as a duplicate.

#16 @sabernhardt
3 years ago

#51861 was marked as a duplicate.

Note: See TracTickets for help on using tickets.