过滤器挂钩manage_edit-post_sortable_columns
包含所有可排序的列。因此,您可以挂接到此筛选器并取消设置title
:
<?php
add_filter( \'manage_edit-post_sortable_columns\', \'wse_240787\' );
function wse_240787( $col ) {
unset( $col[\'title\'] );
return $col;
}
该过滤器记录在wp admin/includes/class wp list表格中。php:
/**
* Filters the list table sortable columns for a specific screen.
*
* The dynamic portion of the hook name, `$this->screen->id`, refers
* to the ID of the current screen, usually a string.
*
* @since 3.5.0
*
* @param array $sortable_columns An array of sortable columns.
*/
$_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
因为我们当前的屏幕Id是
edit-post
过滤器为
manage_edit-post_sortable_columns
.
如果您使用的是自定义帖子类型,屏幕ID将更改为edit-{$cpt_slug}
. 例如,对于页面edit-page
. 如果您的CPT是赞助商,那么edit-sponsor
. (感谢@bravokeyl指出这一点)。