方法1(CSS)
您可以通过CSS为所有非管理员隐藏它:
function hide_ping_track_wpse_103502() {
if( get_post_type() === "post" ){
if( ! current_user_can( \'manage_options\' ) ){
// only for non-admins
echo "<style>.meta-options label[for=ping_status], #ping_status{display:none !important;} </style>";
}
}
}
add_action( \'admin_head-post.php\', \'hide_ping_track_wpse_103502\' );
Before:

After:

方法2(PHP)
您还可以删除本机讨论元盒,并将其替换为您自己的元盒:
add_action( \'admin_menu\', \'remove_discussion_meta_box\' );
add_action( \'add_meta_boxes\', \'add_custom_discussion_meta_box\' );
function remove_discussion_meta_box() {
remove_meta_box(\'commentstatusdiv\', \'post\', \'normal\');
}
function add_custom_discussion_meta_box() {
add_meta_box(
\'custom_discussion\',
__( \'Custom Discussion\' ),
\'custom_discussion_meta_box\',
\'post\'
);
}
function custom_discussion_meta_box($post) {
?>
<input name="advanced_view" type="hidden" value="1" />
<p class="meta-options">
<label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status"
value="open" <?php checked($post->comment_status, \'open\'); ?> />
<?php _e( \'Allow comments.\' ) ?>
</label>
<input name="ping_status" type="hidden" id="ping_status"
value="<?php echo $post->ping_status;?>" />
<?php do_action(\'post_comment_status_meta_box-options\', $post); ?>
</p>
<?php
}
其中
ping_status
表单输入字段用当前值隐藏。
After:
