WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#32499 closed feature request (fixed)

Filter: get_hidden_columns

Reported by: Compute Owned by: chriscct7
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

Today I came across a client that wanted alot of new columns to the admin list screen. As we're also using the WordPress SEO plugin the columns are quickly filled. I would like to hide these columns by default, but for my client to be able to enable the columns again.

add_filter( 'get_user_option_manageedit-coursecolumnshidden', hide_wp_seo_columns' );
public function hide_wp_seo_columns( $hidden ) {
	if ( empty( $hidden ) ) {
		$hidden = [
			'wpseo-score',
			'wpseo-title',
			'wpseo-metadesc',
			'wpseo-focuskw',
		];
	}

	return $hidden;
}

Even if this is working, I believe this would be a quite useful filter inside the get_hidden_columns() function instead. Just like get_hidden_meta_boxes().

Attachments (4)

32499.diff (1.1 KB) - added by Compute 5 years ago.
Introduce filters default_hidden_columns and hidden_columns
32499.2.diff (1.1 KB) - added by MikeHansenMe 5 years ago.
Small style change and patched from src dir
32499.3.diff (1.2 KB) - added by Compute 5 years ago.
Updated patch from src
32499.4.diff (1.2 KB) - added by chriscct7 5 years ago.
Corrected version numbers

Download all attachments as: .zip

Change History (13)

@Compute
5 years ago

Introduce filters default_hidden_columns and hidden_columns

#1 @Compute
5 years ago

  • Keywords has-patch added

@MikeHansenMe
5 years ago

Small style change and patched from src dir

#2 @Compute
5 years ago

Oh, thank you! Will remember to patch from src dir in the future :)

#3 @MikeHansenMe
5 years ago

Patch still applies. Needs a doc update

#4 @chriscct7
5 years ago

  • Keywords needs-refresh added; has-patch removed
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to chriscct7
  • Status changed from new to assigned
  • Version 4.3 deleted

Will refresh this and then it should be good to go.

@Compute
5 years ago

Updated patch from src

#5 @MikeHansenMe
5 years ago

  • Keywords has-patch added; needs-refresh removed

thanks @Compute

@chriscct7
5 years ago

Corrected version numbers

#6 @chriscct7
5 years ago

  • Keywords commit added
  • Status changed from assigned to accepted

This looks good to go

#7 @Compute
5 years ago

Oh yeah. Thanks for the correction :D

#8 @helen
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 33689:

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.

#9 @SergeyBiryukov
4 years ago

#31989 was marked as a duplicate.

Note: See TracTickets for help on using tickets.