[wp-trac] [WordPress Trac] #65204: Custom Bulk Actions missing from Grid View

WordPress Trac noreply at wordpress.org
Thu May 7 23:12:09 UTC 2026


#65204: Custom Bulk Actions missing from Grid View
--------------------------+---------------------------------------------
 Reporter:  takshil       |       Owner:  takshil
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  trunk
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:  ui, javascript, administration
--------------------------+---------------------------------------------

Comment (by takshil):

 Sample plugin to test this issue:

 {{{#!php
 <?php
 /**
  * Plugin Name: Test Media Grid Bulk Action
  * Description: Test plugin for the media grid bulk actions bridge.
 Registers a
  *              single "Generate Alt Text" bulk action via PHP filters.
 With the
  *              core patch, this automatically appears in both list and
 grid views.
  * Version: 1.0.0
  * Author: Test
  */

 if ( ! defined( 'ABSPATH' ) ) {
         exit;
 }

 function test_mgba_add_list_view_bulk_action( $actions ) {
         $actions['generate_alt_text'] = __( 'Generate Alt Text' );
         return $actions;
 }
 add_filter( 'bulk_actions-upload', 'test_mgba_add_list_view_bulk_action'
 );


 function test_mgba_handle_list_view_bulk_action( $redirect_url, $action,
 $post_ids ) {
         if ( 'generate_alt_text' !== $action ) {
                 return $redirect_url;
         }

         // In a real plugin, this would process the attachments.
         $redirect_url = add_query_arg( 'generate_alt_text_count', count(
 $post_ids ), $redirect_url );

         return $redirect_url;
 }
 add_filter( 'handle_bulk_actions-upload',
 'test_mgba_handle_list_view_bulk_action', 10, 3 );
 }}}

 [[Image()]][[Image()]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65204#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list