I am developing a WordPress plugin.

This plugin displays a list of courses. Now I want to implement the bulk actions just like in other plugins. From where I can apply the delete and edit actions to the list.

How will I do this. Is there any built-in function for implementing bulk actions in WordPress?

Any help?

2 s
2

Unfortunately there isn’t a way of doing this yet, see this trac report.

While it would have been possible to add actions to the bulk-actions drop-down menu, there doesn’t exist (yet) a way of handling custom actions. It seems that WordPress deliberately prevents you from adding custom actions (presumably until it’s decided how bulk actions should be handled – see Codex ).

One work-around, which isn’t particularly pretty, is to use javascript to insert extra options into the drop-down menu. However, as mentioned, there is no (supported) way of handling the action – but you could use use the load-* or admin_action_* hook. (See the core files here).

I’ve not checked, but I believe the array of post ID on which to apply the action could be obtained by $_REQUEST['post'] and the action by $_REQUEST['action']

Keep in mind that no checks have been performed, so you would have to check nonces (check_ajax_referrer()) and check the user has the capability to perform that action (current_user_can()).

You may also want to look at this question too: Custom bulk_action

Leave a Reply

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