Make WordPress Core

Opened 14 months ago

#58448 new enhancement

inconsistency in the $items parameter to the handle_bulk_actions-{$screen} action

Reported by: pbiron's profile pbiron Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: Cc:

Description

The handle_bulk_actions-{$screen} action is fired when custom bulk actions are applied on various screens that have list tables.

On /wp-admin/plugins.php, $items is an array of plugin paths relative to WP_PLUGINS_DIR (e.g., classic-editor/classic-editor.php).

On all the other screens, the $items parameter passed to the action's callback is an array of IDs (e.g., post IDs, term IDs, comment IDs, etc). The inconsistency this ticket is about that on some screens the IDs in $items are ints and on other screens they are strings.

Specifically, /wp-admin/edit.php (Posts list table), /wp-admin/upload.php (Media list table), and /wp-admin/edit-comments.php (Comments list table), the IDs are cast to ints via something like array_map( 'intval', (array) $post_ids ) before handle_bulk_actions-{$screen} is fired.

However, on all the other screens (/wp-admin/edit-tags.php, /wp-admin-link-manager.php (Links list table), and /wp-admin/users.php) the IDs are strings.

I think it would be easier on developers (e.g., plugin authors) if when $items is an array of IDs, all IDs were ints.

I don't know if this case be changed at this stage due to BC considerations. But if it can be, I'd be happy to add a patch to that effect.

Change History (0)

Note: See TracTickets for help on using tickets.