Change the order of columns for a custom post type on the admin list page

Yes this is possible. I have changed this for the default post type, but this is also possible for a custom one.

First check the codex:

http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column

function your_columns_head($defaults) {  

    $new = array();
    $tags = $defaults['tags'];  // save the tags column
    unset($defaults['tags']);   // remove it from the columns list

    foreach($defaults as $key=>$value) {
        if($key=='date') {  // when we find the date column
           $new['tags'] = $tags;  // put the tags column before it
        }    
        $new[$key]=$value;
    }  

    return $new;  
} 
add_filter('manage_posts_columns', 'your_columns_head');  

You can change the $defaults array as you like this way.

Leave a Comment