diff --git a/src/wp-admin/css/themes.css b/src/wp-admin/css/themes.css
index 2f132fd669..ee0b4a89a8 100644
--- a/src/wp-admin/css/themes.css
+++ b/src/wp-admin/css/themes.css
@@ -580,6 +580,12 @@ body.folded .theme-overlay .theme-wrap {
margin-bottom: 5px;
}
+/* Hide-if-customize for items we can't add classes to */
+.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-header"],
+.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-background"] {
+ display: none;
+}
+
.broken-themes a.delete-theme,
.theme-overlay .theme-actions .delete-theme {
color: #a00;
diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php
index 3fa903124d..0a7ae7319c 100644
--- a/src/wp-admin/themes.php
+++ b/src/wp-admin/themes.php
@@ -164,22 +164,33 @@ if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
continue;
// 0 = name, 1 = capability, 2 = file
if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
- $class = ' class="current"';
+ $class = ' current';
if ( !empty($submenu[$item[2]]) ) {
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
- $current_theme_actions[] = "{$item[0]}";
+ $current_theme_actions[] = "{$item[0]}";
else
- $current_theme_actions[] = "{$item[0]}";
- } else if ( current_user_can($item[1]) ) {
+ $current_theme_actions[] = "{$item[0]}";
+ } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
$menu_file = $item[2];
- if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
+
+ if ( current_user_can( 'customize' ) ) {
+ if ( 'custom-header' === $menu_file ) {
+ $current_theme_actions[] = "{$item[0]}";
+ } elseif ( 'custom-background' === $menu_file ) {
+ $current_theme_actions[] = "{$item[0]}";
+ }
+ }
+
+ if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
$menu_file = substr( $menu_file, 0, $pos );
+ }
+
if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
- $current_theme_actions[] = "{$item[0]}";
+ $current_theme_actions[] = "{$item[0]}";
} else {
- $current_theme_actions[] = "{$item[0]}";
+ $current_theme_actions[] = "{$item[0]}";
}
}
}