field_name ] * * @return object updated $item_content. NULL if no handler, otherwise * ( 'message' => error or status message(s), 'body' => '', * 'prevent_default' => true to bypass the MLA handler ) */ public static function mla_list_table_bulk_action_item_request( $request, $bulk_action, $post_id, $custom_field_map ) { //error_log( __LINE__ . ' MLAUploadBulkEditExample::mla_list_table_bulk_action_item_request $request = ' . var_export( $request, true ), 0 ); //error_log( __LINE__ . ' MLAUploadBulkEditExample::mla_list_table_bulk_action_item_request $bulk_action = ' . var_export( $bulk_action, true ), 0 ); //error_log( __LINE__ . ' MLAUploadBulkEditExample::mla_list_table_bulk_action_item_request $post_id = ' . var_export( $post_id, true ), 0 ); //error_log( __LINE__ . ' MLAUploadBulkEditExample::mla_list_table_bulk_action_item_request $custom_field_map = ' . var_export( $custom_field_map, true ), 0 ); // If it's not Upload New Media or there's no Title, we're done if ( ! ( isset( $request['screen'] ) && 'async-upload' == $request['screen'] && ! empty( $request['post_title'] ) ) ) { return $request; } // Retrieve the transient and continue the batch or start a new batch $batch = get_transient( 'mla-upload-bulk-edit-example-batch' ); //error_log( __LINE__ . ' MLAUploadBulkEditExample::mla_list_table_bulk_action_item_request $batch = ' . var_export( $batch, true ), 0 ); // Title must match to continue a batch if ( is_array( $batch ) && isset( $batch['post_title'] ) && ( $batch['post_title'] != $request['post_title'] )) { $batch = false; } // Increment or set the counter and modify the Title if ( is_array( $batch ) && isset( $batch['post_title'] ) ) { $batch['instance'] += 1; } else { $batch = array( 'post_title' => $request['post_title'], 'instance' => 1 ); } $request['post_title'] .= ' ' . $batch['instance']; // Save the transient for more batch items set_transient( 'mla-upload-bulk-edit-example-batch', $batch, 300 ); // five minutes //error_log( __LINE__ . ' MLAUploadBulkEditExample::mla_list_table_bulk_action_item_request $request[post_title] = ' . var_export( $request['post_title'], true ), 0 ); return $request; } // mla_list_table_bulk_action_item_request } // Class MLAUploadBulkEditExample /* * Install the filters at an early opportunity */ add_action('init', 'MLAUploadBulkEditExample::initialize'); ?>