查看插件API/过滤器参考的文档
看起来您需要为manage\\u pages\\u custom\\u columns/manage\\u edit-page\\u columns等复制操作和筛选器。公平警告:我尚未对此进行审查。
见下文
https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_edit-post_type_columnshttps://codex.wordpress.org/Plugin_API/Action_Reference/manage_pages_custom_column
下面是有效的结果代码:
// Custom Functions to add SORT BY MODIFIED to post and page editor.
// POSTS
// Register the column
function post_modified_column_register( $columns ) {
$columns[\'post_modified\'] = __( \'Modified\', \'mytextdomain\' );
return $columns;
}
add_filter( \'manage_edit-post_columns\', \'post_modified_column_register\' );
// Display the column content
function post_modified_column_display( $column_name, $post_id ) {
if ( \'post_modified\' != $column_name ){
return;
}
$post_modified = get_post_field(\'post_modified\', $post_id);
if ( !$post_modified ){
$post_modified = \'\' . __( \'undefined\', \'mytextdomain\' ) . \'\';
}
echo $post_modified;
}
add_action( \'manage_posts_custom_column\', \'post_modified_column_display\', 10, 2 );
// Register the column as sortable
function post_modified_column_register_sortable( $columns ) {
$columns[\'post_modified\'] = \'post_modified\';
return $columns;
}
add_filter( \'manage_edit-post_sortable_columns\', \'post_modified_column_register_sortable\' );
//PAGES
// Register the column
function page_modified_column_register( $columns ) {
$columns[\'page_modified\'] = __( \'Modified\', \'mytextdomain\' );
return $columns;
}
add_filter( \'manage_edit-page_columns\', \'page_modified_column_register\' );
// Display the column content
function page_modified_column_display( $column_name, $page_id ) {
if ( \'page_modified\' != $column_name ){
return;
}
$page_modified = get_post_field(\'post_modified\', $page_id);
if ( !$page_modified ){
$page_modified = \'\' . __( \'undefined\', \'mytextdomain\' ) . \'\';
}
echo $page_modified;
}
add_action( \'manage_pages_custom_column\', \'page_modified_column_display\', 10, 2 );
// Register the column as sortable
function page_modified_column_register_sortable( $columns ) {
$columns[\'page_modified\'] = \'page_modified\';
return $columns;
}
add_filter( \'manage_edit-page_sortable_columns\', \'page_modified_column_register_sortable\' );
// end SORT BY MODIFIED