Using Gravity Forms ‘gform_entry_list_bulk_actions’ PHP filter

The gform_entry_list_bulk_actions Gravity Forms PHP filter allows modifying the dropdown of available bulk actions on the entries list. This filter works well with the gform_entry_list_action action for handling the custom actions added.

Usage

To apply this filter to all forms:

add_filter('gform_entry_list_bulk_actions', 'your_function_name', 10, 2);

To limit the scope of your function to a specific form, append the form ID to the end of the hook name (format: gform_entry_list_bulk_actions_FORMID):

add_filter('gform_entry_list_bulk_actions_21', 'your_function_name', 10, 2);

Parameters

  • $actions (array): An array of the bulk actions to be used in the dropdown list.
  • $form_id (int): The ID of the current form.

More information

See Gravity Forms Docs: gform_entry_list_bulk_actions

Examples

Add a custom action to the bulk actions dropdown

This code adds a new custom action called “My Custom Action” to the bulk actions dropdown for the form with ID 21:

add_filter('gform_entry_list_bulk_actions_21', 'add_actions', 10, 2);

function add_actions($actions, $form_id) {
    $actions['my_custom_action'] = 'My Custom Action';
    return $actions;
}

Remove a specific action from the bulk actions dropdown

This code removes the “Mark as Spam” action from the bulk actions dropdown for the form with ID 21:

add_filter('gform_entry_list_bulk_actions_21', 'remove_spam_action', 10, 2);

function remove_spam_action($actions, $form_id) {
    unset($actions['spam']);
    return $actions;
}

Modify an existing action label in the bulk actions dropdown

This code changes the “Mark as Spam” action label to “Mark as Junk” for the form with ID 21:

add_filter('gform_entry_list_bulk_actions_21', 'modify_spam_action_label', 10, 2);

function modify_spam_action_label($actions, $form_id) {
    $actions['spam'] = 'Mark as Junk';
    return $actions;
}

Clear all actions from the bulk actions dropdown

This code removes all actions from the bulk actions dropdown for the form with ID 21:

add_filter('gform_entry_list_bulk_actions_21', 'clear_actions', 10, 2);

function clear_actions($actions, $form_id) {
    return array();
}

Add a custom action to the bulk actions dropdown for all forms

This code adds a new custom action called “My Custom Action” to the bulk actions dropdown for all forms:

add_filter('gform_entry_list_bulk_actions', 'add_actions_all_forms', 10, 2);

function add_actions_all_forms($actions, $form_id) {
    $actions['my_custom_action_all_forms'] = 'My Custom Action';
    return $actions;
}