Make WordPress Core

Opened 7 months ago

Last modified 3 months ago

#61220 new defect (bug)

manage_media_columns filter conflict

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

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.


7 months ago

#2 @antpb
7 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 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
7 months 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.


7 months ago
#4

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