Home / admin / Change wordpress admin post columns order
  • How to Change wordpress admin post columns order

    admin columns with changed order

    I have needed to move a post column like “date, tags, author” or even a custom column within the wordpress admin. This is a simple method that I used to change the order of columns within the admin. What you have is two variables you will need to change $move and $before. Move is the name of the column you would like to move. Before is the name of the column you would like to move it before. The following snippet will let you move the author column before the post title column.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_filter('manage_posts_columns', 'column_order');
    function column_order($columns) {
      $n_columns = array();
      $move = 'author'; // what to move
      $before = 'title'; // move before this
      foreach($columns as $key => $value) {
        if ($key==$before){
          $n_columns[$move] = $move;
        }
          $n_columns[$key] = $value;
      }
      return $n_columns;
    }
    

    If you want to move multiple columns you will need to do things in another way as the above code was just to make things as simple as possible. The next snippet will move both the date and author columns before the post title column.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_filter('manage_posts_columns', 'column_order');
    function column_order($columns) {
      $n_columns = array();
      $before = 'title'; // move before this
      foreach($columns as $key => $value) {
        if ($key==$before){
          $n_columns['date'] = '';
          $n_columns['author'] = '';
        }
          $n_columns[$key] = $value;
      }
      return $n_columns;
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    manage_posts_columns, add_filter,