Sort columns in WordPress admin

Sometimes it's convenient to have certain columns first depending on how you work and what information is important to you.


The columns can be reordered quite easily by just reordering an array in the correct WordPress filter, see manage_{$post_type}_posts_columns.

  • manage_post_posts_columns for blog posts
  • manage_page_posts_columns for pages

WooCommerce specific

  • manage_product_posts_columns
  • manage_order_posts_columns
  
if (is_admin()) {
  add_filter('manage_page_posts_columns', 'YOUR_PREFIX_admin_reorder_page_columns');

  function YOUR_PREFIX_admin_reorder_page_columns($columns) {
    $n_columns = [];
    // create a list of columns in the desired order
    $order = [
      'title',
      'date',
      'author'
      // custom columns can also be added here
    ];
    // remove them from the existing array
    foreach($order as $key) {
      if (array_key_exists($key, $columns)) {
        $n_columns[$key] = $columns[$key];
        unset($columns[$key]);
      }
    }
    // merge the arrays
    return array_merge($n_columns, $columns);
  }
}
  
Load PrismJS Code Highlighting

COPYRIGHT © 2025 | TERMS & CONDITIONS | PRIVACY | BUILT IN SYSTEME.IO