这是添加自定义列的最简单用法:
// Add the custom columns to the post type:
add_filter( \'manage_post_posts_columns\', \'set_custom_edit_book_columns\' );
function set_custom_edit_book_columns($columns) {
$columns[\'status\'] = __( \'Status\', \'your_text_domain\' ); // or simply "Status";
return $columns;
}
// Add the data to the post columns:
add_action( \'manage_post_posts_custom_column\' , \'custom_post_column\', 10, 2 );
function custom_post_column( $column, $post_id ) {
if ( $column == "status" ) {
$p_status = get_post_meta($post->ID, \'status\', true);
echo $p_publish;
}
}
当然,您也可以对该列进行排序,等等!没有测试过,但应该可以,你说得对
您也可以查看这些链接,描述与您的问题几乎相同的问题:
添加自定义列:http://www.deluxeblogtips.com/add-custom-column/
添加可排序列:https://wordpress.org/support/topic/admin-column-sorting/