WordPress.org

Make WordPress Core

Changeset 33689


Ignore:
Timestamp:
08/21/2015 03:31:30 PM (5 years ago)
Author:
helen
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/screen.php

    r32844 r33689  
    5252 */
    5353function get_hidden_columns( $screen ) {
    54     if ( is_string( $screen ) )
     54    if ( is_string( $screen ) ) {
    5555        $screen = convert_to_screen( $screen );
    56 
    57     return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' );
     56    }
     57
     58    $hidden = get_user_option( 'manage' . $screen->id . 'columnshidden' );
     59
     60    if ( ! $hidden ) {
     61        $hidden = array();
     62
     63        /**
     64         * Filter the default list of hidden columns.
     65         *
     66         * @since 4.4.0
     67         *
     68         * @param array     $hidden An array of columns hidden by default.
     69         * @param WP_Screen $screen WP_Screen object of the current screen.
     70         */
     71        $hidden = apply_filters( 'default_hidden_columns', $hidden, $screen );
     72    }
     73
     74    /**
     75     * Filter the list of hidden columns.
     76     *
     77     * @since 4.4.0
     78     *
     79     * @param array     $hidden An array of hidden columns.
     80     * @param WP_Screen $screen WP_Screen object of the current screen.
     81     */
     82    return apply_filters( 'hidden_columns', $hidden, $screen );
    5883}
    5984
Note: See TracChangeset for help on using the changeset viewer.