Filter bulk_actions-post not working in wordpress post screen
in wordpress *wp-admin/edit.php?post_type=post*, I tried to add a new bulk action that exports each post int开发者_运维百科o custom xml for my other application. When i use the following code nothing happes. Can anyone help me to resolve this problem . These are the code that i wrote in function.php
function my_custom_bulk_actions($actions){
$actions['custom_xml_export'] = "Export to XML";
return $actions;
}
function register_custom_bulk_action(){
add_filter('bulk_actions-post','my_custom_bulk_actions');
}
add_action('admin_init','register_custom_bulk_action');
Try this instead:
add_filter('bulk_actions-edit-post','my_custom_bulk_actions');
The screen id you're looking for is "edit-post" not "post".
The Codex lists the screen-ids here: http://codex.wordpress.org/Plugin_API/Admin_Screen_Reference
精彩评论