diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index d69dc57f3..a79be95ab 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -85,18 +85,22 @@ class Custom_Background { if ( empty($_POST) ) return; - check_admin_referer('custom-background'); - if ( isset($_POST['reset-background']) ) { - remove_theme_mod( 'background_image' ); + check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset'); + remove_theme_mod('background_image'); + remove_theme_mod('background_image_thumb'); return; } if ( isset($_POST['remove-background']) ) { // @TODO: Uploaded files are not removed here. + check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove'); set_theme_mod('background_image', ''); + set_theme_mod('background_image_thumb', ''); + return; } if ( isset($_POST['background-repeat']) ) { + check_admin_referer('custom-background'); if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) $repeat = $_POST['background-repeat']; else @@ -104,6 +108,7 @@ class Custom_Background { set_theme_mod('background_repeat', $repeat); } if ( isset($_POST['background-position']) ) { + check_admin_referer('custom-background'); if ( in_array($_POST['background-position'], array('center', 'right', 'left')) ) $position = $_POST['background-position']; else @@ -111,6 +116,7 @@ class Custom_Background { set_theme_mod('background_position', $position); } if ( isset($_POST['background-attachment']) ) { + check_admin_referer('custom-background'); if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) $attachment = $_POST['background-attachment']; else @@ -118,6 +124,7 @@ class Custom_Background { set_theme_mod('background_attachment', $attachment); } if ( isset($_POST['background-color']) ) { + check_admin_referer('custom-background'); $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); if ( strlen($color) == 6 || strlen($color) == 3 ) set_theme_mod('background_color', $color); @@ -156,23 +163,23 @@ class Custom_Background {