请尝试以下操作:
add_filter(\'display_post_states\', \'__return_false\');
负责在帖子列表表上打印帖子状态的功能是:
_post_states()
位于
wp-admin/includes/template.php
.
以下逻辑确定是否打印状态:
/**
* Filter the default post display states used in the posts list table.
*
* @since 2.8.0
*
* @param array $post_states An array of post display states.
* @param WP_Post $post The current post object.
*/
$post_states = apply_filters( \'display_post_states\', $post_states, $post );
if ( ! empty($post_states) ) {
$state_count = count($post_states);
$i = 0;
echo \' — \';
foreach ( $post_states as $state ) {
++$i;
( $i == $state_count ) ? $sep = \'\' : $sep = \', \';
echo "<span class=\'post-state\'>$state$sep</span>";
}
}
NOTE: 考虑到其他人也可能在自己的自定义列表表和/或其他帖子类型中使用此函数,您应该检查上下文,以便不在其他地方进行干扰。