Opened 17 years ago
Closed 16 years ago
#12467 closed defect (bug) (fixed)
deleting the header and background images from media / library doesn't invalidate these files for the theme
| Reported by: | Denis-de-Bernardy | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Template | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
when they're deleted, the theme options should get reset accordingly.
Attachments (1)
Change History (6)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This code would reset the options, if you visit the options page or the frontend you get the default images again. Don't know where we can place this.
function update_theme_mods( $id ) { if ( get_header_image() || get_background_image) { if ( get_header_image() == wp_get_attachment_url( $id ) ) remove_theme_mod( 'header_image' ); elseif ( get_background_image() == wp_get_attachment_url( $id ) ) remove_theme_mod( 'background_image' ); } } add_action( 'delete_attachment', 'update_theme_mods' );