Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#61220 new defect (bug)

manage_media_columns filter conflict

Reported by: grandplugins Owned by:
Priority: normal Milestone: Future Release
Component: Media Version: 6.5.3
Severity: major Keywords: has-patch
Cc: Focuses: administration

Description

The 'manage_media_columns' filter hook in wp-admin/includes/class-wp-media-list-table.php passes two arguments.

<?php
return apply_filters( 'manage_media_columns', $posts_columns, $this->detached );

This filter collides with the "manage_{$screen->id}_columns" filter hook in wp-admin/includes/screen.php which passes one argument.

<?php
$column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() );

Trying to filter in media columns like that works fine in Library page.

<?php
add_filter( 'manage_media_columns', array( $this, 'filter_media_table_columns' ), 100, 2 );

buy results to a Too few arguments fatal error in Add New Media File page

Change History (4)

This ticket was mentioned in ​Slack in #core-media by antpb. ​View the logs.


2 years ago

#2 @antpb
2 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release

Thanks for this ticket! This issue was discussed in a recent Media Component meeting and it was agreed that this either needs its own specific filter separate that more accurately documents the usage or improve the documentation in the existing filter for this edge case that highlights that the second param is needed. Moving this to Future Release to allow this some time for others input.

#3 @narenin
2 years ago

Hi,

I have added this to documentation, so when someone "use manage_{$screen->id}_columns" filter, so when User use this filter he will be aware of that.

Hook Details : ​https://developer.wordpress.org/reference/hooks/manage_screen-id_columns/

PR : ​https://github.com/WordPress/Documentation-Issue-Tracker/issues/1560

This ticket was mentioned in ​PR #6615 on ​WordPress/wordpress-develop by ​@narenin.


2 years ago
#4

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.