WordPress:永久删除自定义帖子类型的帖子。删除:“已将1条帖子移至垃圾箱。撤消”信息 [英] Wordpress: Permanently deleting custom post type post. remove the: "1 post moved to the Trash. Undo" message

查看:99
本文介绍了WordPress:永久删除自定义帖子类型的帖子。删除:“已将1条帖子移至垃圾箱。撤消”信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果已经有了答案,但我找不到它。

Sorry if there is already an answer to this but I couldn't find it.

因此,我有这个脚本可以从自定义帖子类型中永久删除帖子。
它会永久删除帖子。但是在删除之后,我收到此消息:

So I have this script that permanently deletes a post from a custom post type. It does permanently delete the post. but after it's deleted I get this message:

但我希望此消息消失,因为即使您按了撤消按钮,它也会显示:

But I want this message gone because even if u the press undo button it just says:

删除帖子的代码是:

function members_skip_trash($post_id) {
    if (get_post_type($post_id) == 'members') { 
        // Force delete
        wp_delete_post( $post_id, true );
    }
}
add_action('trashed_post', 'members_skip_trash');

那么我如何摆脱移到垃圾邮件的1条帖子?

So how do I get rid of the 1 post moved to the trash message?

推荐答案

一种快速而肮脏的方法是找到以下文件:

A quick and dirty way to do it would be to find this file:

/wp-admin/edit.php

并注释掉以下行:

echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';

当然,这将消除您所有移至垃圾箱消息。因此,您可能希望将其保留在其中,但是请先检查您的自定义帖子类型。

Of course that will get rid of all your 'moved to Trash' messages. So you'll probably want to keep it in there, but check for your custom post type first.

或者更好的是,找出如何从<$中覆盖它c $ c> functions.php 文件,因此下一个WP更新不会杀死它。

Or better yet, figure out how to override this from your functions.php file so the next WP update doesn't kill it.

这篇关于WordPress:永久删除自定义帖子类型的帖子。删除:“已将1条帖子移至垃圾箱。撤消”信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆