admin管理员组文章数量:1292306
I'm following this tutorial to add custom bulk actions to my dashboard but I have multiple custom post types. So far I was able to achieve what I want with
// functions.php
// The same line for each Custom Post Type
add_filter( 'bulk_actions-edit-notre_offre', 'custom_bulk_actions' );
add_filter( 'bulk_actions-edit-financements', 'custom_bulk_actions' );
add_filter( 'bulk_actions-edit-le_groupe', 'custom_bulk_actions' );
add_filter( 'bulk_actions-edit-actualites', 'custom_bulk_actions' );
add_filter( 'bulk_actions-edit-ressources', 'custom_bulk_actions' );
add_filter( 'bulk_actions-edit-legal', 'custom_bulk_actions' );
add_filter( 'bulk_actions-edit-page', 'custom_bulk_actions' ); // default WordPress apges
function custom_bulk_actions( $bulk_array ) {
$bulk_array['custom_bulk_make_draft'] = 'Draft';
$bulk_array['custom_bulk_publish'] = 'Publish';
return $bulk_array;
}
// [handler that also uses a bunch of add_filter()'s]
I feel like that's not the optimal way to do it.
Is there a way to merge all my add_filter()
lines into one? Also, are there any negative effects on performance with the way I currently do this?
本文标签: phpHow do I add custom bulk actions to multiple custom post types
版权声明:本文标题:php - How do I add custom bulk actions to multiple custom post types? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741550186a2384834.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论