From 514caf0120d7200e6c0c972d5a0545554b0d58fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helen=20Hou-Sand=C3=AD?= Date: Fri, 21 Aug 2015 15:32:29 +0000 Subject: [PATCH] List tables: Allow filtering of hidden and default hidden columns. Similar to `get_hidden_meta_boxes()`, there are now filters named `default_hidden_columns` and `hidden_columns`. props Compute, MikeHansenMe, chriscct7. fixes #32499. Built from https://develop.svn.wordpress.org/trunk@33689 git-svn-id: http://core.svn.wordpress.org/trunk@33656 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/screen.php | 29 +++++++++++++++++++++++++++-- wp-includes/version.php | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index fba5dc9da0..d23cff36a3 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -51,10 +51,35 @@ function get_column_headers( $screen ) { * @return array */ function get_hidden_columns( $screen ) { - if ( is_string( $screen ) ) + if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); + } - return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' ); + $hidden = get_user_option( 'manage' . $screen->id . 'columnshidden' ); + + if ( ! $hidden ) { + $hidden = array(); + + /** + * Filter the default list of hidden columns. + * + * @since 4.4.0 + * + * @param array $hidden An array of columns hidden by default. + * @param WP_Screen $screen WP_Screen object of the current screen. + */ + $hidden = apply_filters( 'default_hidden_columns', $hidden, $screen ); + } + + /** + * Filter the list of hidden columns. + * + * @since 4.4.0 + * + * @param array $hidden An array of hidden columns. + * @param WP_Screen $screen WP_Screen object of the current screen. + */ + return apply_filters( 'hidden_columns', $hidden, $screen ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 3f8b619174..c4311c15d6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33688'; +$wp_version = '4.4-alpha-33689'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.