我试图在帖子从垃圾桶中删除后添加一个自定义信息通知,但我没有任何运气
add_action( \'delete_post\', \'show_admin_notice\' );
/**
* Show admin notice after post delete
*
* @since 1.0.0.
*/
function show_admin_notice(){
add_action( \'admin_notices\', \'show_post_order_info\' );
}
/**
* Display notice when user deletes the post
*
* When user deletes the post, show the notice for the user
* to go and refresh the post order.
*
* @since 1.0.0
*/
function show_post_order_info() {
$screen = get_current_screen();
if ( $screen->id === \'edit-post\' ) {
?>
<div class="notice notice-info is-dismissible">
<p><?php echo esc_html__( \'Please update the \', \'nwl\' ) . \'<a href="\' . esc_url( admin_url( \'edit.php?page=post-order\' ) ). \'">\' . esc_html__( \'post order settings\', \'nwl\' ) . \'</a>\' . esc_html__( \' so that the posts would be correctly ordered on the front pages.\', \'nwl\' ); ?></p>
</div>
<?php
}
}
很明显,我在这里遗漏了一些东西,但我无法在谷歌上找到什么。如果我使用admin_notices
胡克,我会在我的帖子管理页面上看到通知