Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
2  
This question is too localized for this forum. There is not enough information provided to even begin to find an answer. Please update your question with more details about the courses specifically. –  Brian Fegter Feb 9 '12 at 6:32
1  
@BrianFegter That seems a bit harsh - I'm pretty sure he's talking about bulk actions at the top/bottom of the table e.g. with the users table. The course details aren't really needed. –  icc97 Feb 9 '12 at 8:30
2  
This seems similar to this question: wordpress.stackexchange.com/questions/24847/… –  icc97 Feb 9 '12 at 8:34
    
@icc97 yes I am talking about that bulk actions at the top/bottom of the table. How will I add that to my table. –  Ahmad Feb 9 '12 at 8:35
2  
@icc97 'bulk actions just like in other plugins' is very vague, hence my comment. There's no mention of where this is surfaced in said plugin. Is it the posts list or is this a completely custom table within a custom plugin page? There are several ways to approach this. Just trying to get better definition. –  Brian Fegter Feb 9 '12 at 14:58
show 2 more comments

2 Answers

Stephen Harris is right that there is no built-in way of accomplishing the addition of custom actions to the bulk menu.

Since he replied, Justin Stern has published the best thing written on the subject to date: Add a WordPress Custom Bulk Action. It indeed uses Javascript (jQuery). It might be all you need... at least until the WP crew gives us a built-in way to do this.

On the remote possibility you're looking to add bulk actions to the media page, you need to adapt Justin's code. For that look here: http://wordpress.stackexchange.com/a/92098/23086.

share|improve this answer
    
+1, that works well. –  webaware May 5 '13 at 5:56
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.