The bulk_edit_custom_box WordPress action fires once for each column in Bulk Edit mode and allows you to customize the appearance and functionality of the bulk edit columns.
Table of contents
Usage
add_action('bulk_edit_custom_box', 'your_custom_function', 10, 2);
function your_custom_function($column_name, $post_type) {
// your custom code here
return $column_name;
}
Parameters
$column_name(string): Name of the column to edit.$post_type(string): The post type slug.
More information
See WordPress Developer Resources: bulk_edit_custom_box
Examples
Add custom taxonomy dropdown
Add a custom taxonomy dropdown in the bulk edit screen for a custom post type ‘movies’.
add_action('bulk_edit_custom_box', 'add_custom_taxonomy_dropdown', 10, 2);
function add_custom_taxonomy_dropdown($column_name, $post_type) {
if ($post_type == 'movies' && $column_name == 'taxonomy-name') {
// Display a custom taxonomy dropdown
}
}
Add a custom checkbox for featured posts
Add a custom checkbox to mark posts as featured in the bulk edit screen.
add_action('bulk_edit_custom_box', 'add_featured_checkbox', 10, 2);
function add_featured_checkbox($column_name, $post_type) {
if ($post_type == 'post' && $column_name == 'featured') {
// Display a custom checkbox for featured posts
}
}
Add custom price input for WooCommerce products
Add a custom price input field in the bulk edit screen for WooCommerce products.
add_action('bulk_edit_custom_box', 'add_price_input', 10, 2);
function add_price_input($column_name, $post_type) {
if ($post_type == 'product' && $column_name == 'price') {
// Display a custom price input field
}
}
Add custom input field for post excerpt
Add a custom input field for post excerpt in the bulk edit screen for a custom post type ‘recipes’.
add_action('bulk_edit_custom_box', 'add_excerpt_input', 10, 2);
function add_excerpt_input($column_name, $post_type) {
if ($post_type == 'recipes' && $column_name == 'excerpt') {
// Display a custom input field for post excerpt
}
}
Add a custom dropdown for post format
Add a custom dropdown for post format in the bulk edit screen for ‘post’ post type.
add_action('bulk_edit_custom_box', 'add_post_format_dropdown', 10, 2);
function add_post_format_dropdown($column_name, $post_type) {
if ($post_type == 'post' && $column_name == 'format') {
// Display a custom dropdown for post format
}
}