Blog

Everything you need to know about bulk actions in WordPress

complete tutorial on using bulk actions in WordPress
Table of Contents

what is bulk action in WordPress? WordPress Bulk actions is a useful solution for editing different features of multi posts or multi-pages in your website at the same time. Using bulk actions WordPress shows its powers when you are struggling with a huge number of posts and pages. In this way, you can edit any features such as categories, comments, authors, or tags simultaneously.

Although the default items available for doing bulk actions in WordPress are limited, they can help you to save a great time in editing multi posts and pages. 

How to use bulk editing post features in WordPress?

The bulk actions are available for editing below features of posts by default in WordPress:

  • Categories and tags
  • Author.
  • Comments.
  • Formats.
  • Pingbacks.
  • Make Sticky.

The bulk actions WordPress are available for editing below features of pages by default:

  • Author.
  • Parent page.
  • Template.
  • Comments.
  • Status.

Let’s take a look at how doing bulk action in WordPress can help you to make your desired changes very fast and easy on multiple posts.

WordPress bulk edit posts

To do bulk edit actions in WordPress, at first you need to mark the posts or pages that need to be edited.

Then you have to choose edit from the bulk actions combo box above the posts or pages list:

WordPress bulk edit posts

It’s then possible to make changes to the available features of those selected posts or pages at the same time. 

WordPress bulk edit categories

For example, if you choose a new category to be assigned to them:

WordPress bulk edit categories

Then click on “Apply“:

click on Apply to change the category of selected posts

The category of those selected posts will be changed simultaneously.

WordPress bulk edit authors 

Bulk change author WordPress is also possible as below:

WordPress bulk edit authors

WordPress bulk edit tags

And you can change tags for multiple posts/pages as well:

WordPress bulk edit tags

Delete multiple post / custom post

It is also possible to bulk delete multiple posts or pages in the same way by marking preferred posts/pages then choosing move to trash option from the Bulk actions combo box.

Delete multiple post / custom post

Limitations of default bulk actions WordPress

There is no doubt that these options are very useful for handling and managing multiple posts and pages in WordPress, however, they are not as flexible as you may need for making changes on any features of your posts/ pages such as titles, images, publishing status, post contents, custom fields and so on.

To overcome these restrictions, you have to use one of the below methods:

Add bulk actions to the WordPress by code writings

Activating plugins that can help you to bulk edit WordPress features with more flexibility 

Follow this tutorial to learn how to use these methods for bulk editing post and page features.

How to add bulk actions to WordPress by code writing?

To add bulk edit actions to WordPress, you need to follow three steps:

Step1: Write a code to add option in the bulk actions combo box

For example, you can add the below codes to add related items to the bulk actions dropdown list:

bulk_actions-edit-post
bulk_actions-edit-page
bulk_actions-edit-<post-type-name>
bulk_actions-edit-<custom-taxonomy>
bulk_actions-edit-comments
bulk_actions-plugins
bulk_actions-users
bulk_actions-upload 

Step2: Write a code to make that added option do something

To make the added options do something after selecting from the dropdown list, you have to hook onto the filter handle_bulk_actions-<screen> in the same screen the option has been added.

Three arguments are available in this filter that you need to apply your auction onto:

  • An URL that WordPress should redirect to.
  • Name of the action that was chosen in the dropdown.
  • An array of all element IDs that were checked for the bulk action.

Step3: Write a code to instruct WordPress show a notification after doing that action

To show admin notices, you can use the action admin_notices in your code.

To make it clear for you, let’s make some useful examples:

Example 1: Add Email to Eric to the bulk actions of WordPress posts

As we mentioned above you need to write a code to register a callback on the “bulk_actions-{screen_id}” filter and add this option to the dropdown list. When you are writing this code on your website, you need to replace “{screen_id}” with the ID of the admin screen.

So, you can use the below code:

add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions' ); function register_my_bulk_actions($bulk_actions) {  $bulk_actions['email_to_eric'] = __( 'Email to Eric', 'email_to_eric');  return $bulk_actions;}

As you can see in the below picture, the option has been added to the bulk actions combobox:

 Add Email to Eric to the bulk actions of WordPress posts

Example 2: Add “Change to publish” to the bulk actions of WordPress posts, make it do its task and show notification 

To add this filter to the dropdown list (Step1), using the below code seems helpful:

add_filter('bulk_actions-edit-post', function($bulk_actions) {
$bulk_actions['change-to-published'] = __('Change to published', 'txtdomain');
return $bulk_actions;
});

After saving and refreshing posts screen, you can see the “Change to published” has been added to the bulk actions combo box:

change to publish status added to bulk action combo box

To make the Changed to publish loops through all post IDs and perform the bulk action (Step2), you need to add the below code in the same screen to performs “wp_update_post()” on each ID to change their post status to published:

add_filter('handle_bulk_actions-edit-post', function($redirect_url, $action, $post_ids) {
if ($action == 'change-to-published') {
foreach ($post_ids as $post_id) {
wp_update_post([
'ID' => $post_id,
'post_status' => 'publish'
]);
}
$redirect_url = add_query_arg('changed-to-published', count($post_ids), $redirect_url);
}
return $redirect_url;
}, 10, 3);

By using this code, you added a new query arg with “add_query_arg()” setting ‘changed-to-published‘ to the number of post IDs that were selected and expect to:

  • Do your auction on the selected IDs.
  • Build a URL to instruct WordPress to redirect to.
  • Show an admin notification.

To instruct WordPress to show a notice after the bulk action is done (Step3), you can use the action admin_notices in your code as below:

add_action('admin_notices', function() {
if (!empty($_REQUEST['changed-to-published'])) {
$num_changed = (int) $_REQUEST['changed-to-published'];
printf('<div id="message" class="updated notice is-dismissable"><p>' . __('Published %d posts.', 'txtdomain') . '</p></div>', $num_changed); }
});

In this piece of code, you have checked PHP’s global variable, $_REQUEST, that are populated with form submitted values if ‘changed-to-published‘ exists. If it confirms that WordPress has completed the bulk action, it reloads the page with the following in the URL: “wp-admin/edit.php?changed-to-published=’number of published posts’”.

For example, if 2 posts are published after doing this bulk action, the below notice will be displayed after reloading the page:

notify published 2 posts

Example 3: Update a custom post meta that informs whether or not posts are verified

To do WordPress bulk action for any selected items, you can simply use “handle_bulk_actions-<screen>” hook. So, if you want to update a custom post meta that informs whether or not posts are verified using a custom bulk action with key ‘mark-as-verified‘ as below is helpful:

add_filter('handle_bulk_actions-edit-post', function($redirect_url, $action, $post_ids) {
if ($action == 'mark-as-verified') {
foreach ($post_ids as $post_id) {
update_post_meta($post_id, 'verified', '1');}
$redirect_url = add_query_arg('mark-as-verified', count($post_ids), $redirect_url);}
return $redirect_url;
}, 10, 3);

By using this piece of code, a custom column is also added that shows the value of ‘verified’ in posts lists as you can see in the below picture:

marked as verified option

What is WordPress post bulk edit plugin?

If you are not good at using codes or adding them to your WordPress website for customizing bulk actions, there is nothing to worry about. About 70% of web owners who powered their site with WordPress have are in the same situation and have zero knowledge about code writing. The best solution for doing bulk action without even wring a single line of code is using WordPress bulk actions plugins.

There are a lot of free or premium bulk edit plugins available in the WordPress respiratory or third-party websites to help you edit and customize multiple posts or pages features at the same time.

The free WordPress post/page bulk edit plugin usually offers some limited options for editing the features. They contain a piece of code like the examples we mentioned above to help you do one or two bulk editing actions on your posts or pages.

While the premium bulk editing plugins provide a lot more flexible and comprehensive options for editing and customizing features of multi posts or pages. By activation of them on your WordPress site, you may have access to a spreadsheet or a table including all of your posts or pages which really facilitate filtering and editing any features by working with their user-friendly interface.

Stay with us to see how you can use these powerful plugins for doing bulk edit actions on WordPress.

  • Switch WordPress post types

It is very common for sit managers to need to change the types of multiple posts at the same time. By default, there are five types in WordPress that you can assign to your posts including:

  • Posts.
  • Pages.
  • Attachments.
  • Revisions.
  • Menus.

Consider that you want to change the types of 20 posts in one day, it’s obvious that this task is very frustrating and time-consuming if you have to open their pages individually and change their types one by one. 

However, there are some free plugins such as Post Type Switcher plugin available in the WordPress respiratory that you can easily install and activate them to do bulk action for changing post types.

To switch multiple post types by bulk editing after activation of the Post Type Switcher plugin on your WordPress website, follow the below actions:

  • Go to “All Posts”.
  • Mark the posts you want to switch their types.
  • In the Bulk Actions drop-down list, select Edit and press the Apply button to see all selected posts in Quick edit mode.
  • Switch the “post type” as you prefer.
Changing post type for multiple posts with bulk edit

  • Filter, select and change specific posts

To filter, select and change specific posts, you need to install a free or premium plugin on your site as these features are not available by default on WordPress websites. One of the most helpful plugins for doing these tasks is Search & Filter plugin. 

When this plugin is activated on your website, a new menu item appears on the WordPress admin bar labeled Search & Filter. If you click on this tab, you will see some useful information about how to use the shortcodes to add Filtering and searching options to your posts or pages.

For example, you can use the below shortcode in any post or page to build a search box with search, category, and tags fields:

[searchandfilter fields="search,category,post_tag"]

The result looks like below:

Filter posts by category and tags

  • Adding or editing post in a short time

Adding or editing posts in a short time needs a powerful plugin to be installed on WordPress websites to make these options available for doing bulk actions on the selected posts. There are more than 100 plugins that can help you to add or edit multiposts at the same time. 

For example, WPBE – WordPress Posts Bulk Editor Professional is one of the most popular plugins designed to help you manage and edit the data of multiple posts, pages, or custom posts in a short time.

By activation of this bulk post-editing plugin, you are can filter your preferred posts then do bulk edit actions to edit their fields or meta fields at the same time.

WPBE provides all necessary options for facilitating bulk actions such as bind editing. The only disadvantage that may disappoint you to install this plugin is its compatibility. Unfortunately, WordPress Posts Bulk Editor Professional is not compatible with WooCommerce so if you have already installed WooCommerce on your website it’s better not to use WPBE for bulk editing.

  • Duplicate posts / custom posts

Duplicating multiple posts/custom posts is another feature that you may need for managing your website which is not provided on WordPress by default. To perform this action, you need to use some WordPress plugins like WP Bulk Post Duplicator.

If you want to duplicate multiple posts by this plugin, you just need to specify their post type, status, and date of publishing:

Bulk Duplicate Settings - post type and status

You can also specify the status of duplicated posts, then by clicking on the Duplicate button, all of them will be duplicated in a few seconds.

Bulk Duplicate Settings - year and publish status

  • Bind editing

Bind editing is an effective and flexible way for doing bulk actions on the post or page data. WordPress Bulk Posts Editing Plugin is one of the most powerful plugins that enable you to do both bulk editing and bind editing of multiple post fields or meta fields.

In this plugin, all of your posts will be displayed in a table and you can add the post data as the columns to the table.

It is also possible to filter posts according to any field such as status, publish date, etc. Then bulk edit the data you need by using a comprehensive bulk edit form containing all data related to the posts or bind editing any column directly on the table columns.

bind editing using WordPress bulk posts editing plugin

To bind edit post data on the table of WordPress bulk posts editing plugin, you just need to:

  1. Mark the “Bind Edit” option in “Toolbar
  2. Check your preferred posts or custom posts in the table 
  3. Edit the desired fields with the desired values, it is enough to do this only for one of the posts

This plugin has a very user-friendly interface and it is compatible with most of the common plugins of WordPress such as WooCommerce.

Conclusion

Doing bulk actions on WordPress post or page features is necessary for the site managers publishing numerous types of posts or pages on their websites to facilitate their task and save their time. 

There are some bulk actions such as changing category or tags of multiple posts/pages available on WordPress by default. However, these options are not as comprehensive and user-friendly as website managers expected.

To make these options more flexible and add extra tools for bulk editing or bind editing post/page features, you need to add a piece of code to WordPress manually or install some useful plugin to enable you to do bulk actions in a user-friendly interface.

In this post, we have introduced you the most popular plugins helpful for doing bulk actions on WordPress and we have also offered some common codes that you can add to the WordPress to bulk editing some special features.

If you are working with numerous posts or pages on your website, we recommend you to install and activate powerful plugins to make bulk editing all features of posts possible robustly.

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha loading...

Shopping cart
Sign in

No account yet?

We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies.

Start typing to see products you are looking for.
1-5 of 424 reviews
  1. D

    Amazing plugin! I can’t say enough good things about it. Highly recommended.

  2. S

    As a busy store owner, I needed a solution to streamline my order management process. This plugin has been a lifesaver. I can now process bulk orders quickly and easily.

  3. K

    I just had a issue with this plugin and the tech team was very quick to help me solve the problem, great!

  4. S

    Very helpfuls support team. My issue was resolved within 2 days.

  5. A

    its what i want and its good