[wp-trac] [WordPress Trac] #12467: deleting the header and background images from media / library doesn't invalidate these files for the theme

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 15 18:40:30 UTC 2010


#12467: deleting the header and background images from media / library doesn't
invalidate these files for the theme
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:           
     Type:  defect (bug)       |      Status:  new      
 Priority:  normal             |   Milestone:  3.0      
Component:  Template           |     Version:  3.0      
 Severity:  normal             |    Keywords:  has-patch
-------------------------------+--------------------------------------------
Changes (by ocean90):

  * keywords:  => has-patch


Comment:

 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' );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12467#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list