Opened 14 years ago
Last modified 5 years ago
#16396 new enhancement
Add a hook to the theme editor page when the write is successful
Reported by: | scottconnerly | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1.3 |
Component: | Themes | Keywords: | needs-refresh |
Focuses: | Cc: |
Description
Add a filter to the end of theme-editor.php's processing when the write is successful.
Attachments (1)
Change History (13)
#2
@
14 years ago
The use case is for managing a Wordpress install on an SVN-controlled server. Whenever the CMS changes a file's contents (particularly in the wp-content folder) I need to be able to trigger an svn commit.
#7
@
14 years ago
- Cc trac@… added
- Keywords has-patch added
- Summary changed from theme-editor filter to Add a hook to the theme editor page when the write is successful
ticket.16396.diff adds a new 'edited_theme' action, passing the theme's template name, the file edited, and the new content as parameters.
#8
@
13 years ago
- Cc ericlewis added
- Version changed from 3.0.4 to 3.1.3
This is definitely out of the scope of all hooks currently. In theme-editor.php, from lines 82-100 the new contents of the file are written, a redirect location is set, and then exit(). Inserting this line at 96 would work well:
do_action('theme_file_updated', $file, $theme );
#9
@
13 years ago
- Cc jose.sg added
I just had a lovely chat with the people in #wordpress about just this feature. For reference, see http://wordpress.org/support/topic/unable-to-update-wordpress-theme?replies=8, but essentially I wanted to be able to clear the APC cache when a WordPress theme was updated.
The consensus seemed to be that I should not be using the online editor, which is fine except that:
- It exists, so it must serve a purpose
- I'm not going to try and teach a designer yet another tool (ssh) in order to let her get work done
Since this ticket appears to have died (other than the resuscitation by @ericlewis prompted by my wordpress discussion), I created a plugin that seems to work for my use-case (I seem to have lost my commit rights on the wp svn a few years ago). https://gist.github.com/a92e511c5f1d299716cc contains the plugin, for anyone stumbling upon this ticket.
Makes a hook for both theme and plugin file updating, as well as menu items such that they can be triggered on demand (in case you do edit them from the command-line). One caveat is that I think themes are loaded before plugins, and so it looks like calling this hook from a theme's functions.php file fails. Not sure what the best solution to this is.
It would be nice to have official support for this particular request, but again, it appears discussion about this ticket has died, so I figured I'd post my findings for future developers.
You have a better chance of getting a hook if you can give a use case and demonstrate that it can't be achieved using one of the existing hooks.