正如@Toscho所说,标题列是硬编码的,因此您无法更改它。但是,您可以删除该列并将其重新定义为自定义列:
add_filter( \'manage_pages_columns\', \'wpse248405_columns\', 25, 1 );
function wpse248405_columns ($cols) {
// remove title column
unset( $cols[\'title\'] );
// add custom column in second place
$cols = array(\'cb\' => $cols[\'cb\']) + array(\'title\' => __( \'Title\', \'textdomain\' )) + $cols;
// return columns
return $cols;
}
现在必须使自定义列正常工作
like the original:
add_action( \'manage_pages_custom_column\', \'wpse248405_custom_column\', 10, 2 );
function wpse248405_custom_column( $col, $post_id ) {
if ($col == \'title\') {
$post = get_post( $post_id );
$title = _draft_or_post_title();
$can_edit_post = current_user_can( \'edit_post\', $post->ID );
// set up row actions
$actions = array();
if ( $can_edit_post && \'trash\' != $post->post_status ) {
$actions[\'title\'] = \'<strong><a href="\' . get_edit_post_link( $post->ID, true ) . \'" aria-label="\' . $title . esc_attr( __( \'Edit this item\' ) ) . \'">\' . $title . \'</a></strong>\';
// invoke row actions
$table = new WP_Posts_List_Table;
echo $table->row_actions( $actions, true );
}
}
}
请注意,如果您在自己的函数中模仿核心行为,则很容易受到未来核心版本的攻击。