您可以使用tag_row_actions
hook (在WP v3.0.0中已弃用,但在WP v5.4.2中已恢复)目标any taxonomies(标签/post_tag
, 类别/category
, a_custom_taxonomy
, 等等),所以只需更换category_row_actions
具有tag_row_actions
:
add_filter( \'tag_row_actions\', \'category_row_actions\', 10, 2 );
或者你可以使用
get_taxonomies()
用一个早期的钩子
admin_init
(之后运行
init
), 然后为目标分类添加过滤器,如下所示:
add_action( \'admin_init\', function () {
// This adds the filter for *all* taxonomies.
foreach ( get_taxonomies() as $taxonomy ) {
add_filter( "{$taxonomy}_row_actions", \'category_row_actions\', 10, 2 );
}
/*
// This one adds the filter for *public* taxonomies only.
foreach ( get_taxonomies( array( \'public\' => true ) ) as $taxonomy ) {
add_filter( "{$taxonomy}_row_actions", \'category_row_actions\', 10, 2 );
}
*/
} );