bulk_post_updated_messages

最后更新于:2021-11-25 22:31:25

apply_filters( ‘bulk_post_updated_messages’, array[] $bulk_messages, int[] $bulk_counts )

Filters the bulk action updated messages.

参数

$bulk_messages

(array[])
Arrays of messages, each keyed by the corresponding post type. Messages are keyed with ‘updated’, ‘locked’, ‘deleted’, ‘trashed’, and ‘untrashed’.

$bulk_counts

(int[])
Array of item counts for each message, used to build internationalized strings.

源文件

文件: gc-admin/edit.php

View on Trac

add_filter( 'bulk_post_updated_messages', 'my_bulk_post_updated_messages_filter', 10, 2 );

function my_bulk_post_updated_messages_filter( $bulk_messages, $bulk_counts ) {

    $bulk_messages['my_cpt'] = array(
        'updated'   => _n( '%s my_cpt updated.', '%s my_cpts updated.', $bulk_counts['updated'] ),
        'locked'    => _n( '%s my_cpt not updated, somebody is editing it.', '%s my_cpts not updated, somebody is editing them.', $bulk_counts['locked'] ),
        'deleted'   => _n( '%s my_cpt permanently deleted.', '%s my_cpts permanently deleted.', $bulk_counts['deleted'] ),
        'trashed'   => _n( '%s my_cpt moved to the Trash.', '%s my_cpts moved to the Trash.', $bulk_counts['trashed'] ),
        'untrashed' => _n( '%s my_cpt restored from the Trash.', '%s my_cpts restored from the Trash.', $bulk_counts['untrashed'] ),
    );

    return $bulk_messages;

}