Return to Snippet

Revision: 47072
at May 31, 2011 21:21 by flyworks


Initial Code
add_filter( 'manage_posts_columns', 'namespace_AddXXXColumn' );
add_action( 'manage_posts_custom_column', 'namespace_AddXXXValue', 10, 2 );

function namespace_AddXXXColumn($cols) { 
        $cols['xxx'] = __('XXX'); 
        return $cols;
}
function namespace_AddXXXValue($column_name, $post_id) {
    if ( 'xxx' == $column_name ) {
        echo get_permalink($post_id); // for example
    }
}
// Register the column as sortable
function xxx_column_register_sortable( $columns ) {
	$columns['xxx'] = 'xxx';
 
	return $columns;
}
add_filter( 'manage_edit-post_sortable_columns', 'xxx_column_register_sortable' );

Initial URL

                                

Initial Description

                                

Initial Title
Add sortable column to WordPress admin

Initial Tags
wordpress

Initial Language
PHP