【问题标题】:Wordpress: Change message given when deleting post from custom post typeWordpress:从自定义帖子类型中删除帖子时更改消息
【发布时间】:2020-03-04 12:47:03
【问题描述】:

所以我有一个称为成员的自定义帖子类型。与高级自定义字段链接。 我已经做到了,所以如果我从自定义帖子类型中删除一个成员,它不会移动到垃圾箱并永久删除它。但我仍然收到这条消息:


我正在尝试更改此消息。

我试图在/wp-admin/edit.php 中覆盖的行是:

'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),

我尝试在functions.php 中更改的代码如下:

add_filter( 'post_trashed_messages', function( $messages )
{
    $messages['post'][2] = 'Succesfully deleted';
    return $messages;
} );

我无法更改它。 那么是否有可能完全删除通知

【问题讨论】:

    标签: php wordpress advanced-custom-fields custom-post-type notice


    【解决方案1】:

    所以我如何让它工作是这样的:

    add_filter( 'bulk_post_updated_messages', function ( $bulk_messages, $bulk_counts ) {
        $bulk_messages['post']['trashed'] = _n( '%s post successfully deleted.', '%s posts successfully deleted.', $bulk_counts['trashed'] );
        return $bulk_messages;
    }, 10, 2 );
    

    【讨论】:

      猜你喜欢
      • 2020-06-11
      • 2020-06-12
      • 1970-01-01
      • 2020-02-23
      • 1970-01-01
      • 2016-04-27
      • 1970-01-01
      • 2015-01-15
      • 1970-01-01
      相关资源
      最近更新 更多