if ( ! isset( $column_headers[ $screen->id ] ) ) {
/**
- * Filter the column headers for a list table on a specific screen.
+ * Filters the column headers for a list table on a specific screen.
*
* The dynamic portion of the hook name, `$screen->id`, refers to the
* ID of a specific screen. For example, the screen ID for the Posts
$hidden = array();
/**
- * Filter the default list of hidden columns.
+ * Filters the default list of hidden columns.
*
* @since 4.4.0
*
}
/**
- * Filter the list of hidden columns.
+ * Filters the list of hidden columns.
*
* @since 4.4.0
* @since 4.4.1 Added the `use_defaults` parameter.
// Submit box cannot be hidden
if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
continue;
- $box_id = $box['id'];
- echo '<label for="' . $box_id . '-hide">';
- echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
- echo "{$box['title']}</label>\n";
+
+ $widget_title = $box['title'];
+
+ if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) {
+ $widget_title = $box['args']['__widget_basename'];
+ }
+
+ printf(
+ '<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>',
+ esc_attr( $box['id'] ),
+ checked( in_array( $box['id'], $hidden ), false, false ),
+ $widget_title
+ );
}
}
}
}
/**
- * Filter the default list of hidden meta boxes.
+ * Filters the default list of hidden meta boxes.
*
* @since 3.1.0
*
}
/**
- * Filter the list of hidden meta boxes.
+ * Filters the list of hidden meta boxes.
*
* @since 3.3.0
*
*
* @global WP_Screen $current_screen
*
- * @return WP_Screen Current screen object
+ * @return WP_Screen|null Current screen object or null when screen not defined.
*/
function get_current_screen() {
global $current_screen;