开发者

Filter bulk_actions-post not working in wordpress post screen

开发者 https://www.devze.com 2023-03-25 01:08 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消