[wp-trac] [WordPress Trac] #39457: Custom order of categories in Admin (post.php, post-new.php) broken in 4.7

WordPress Trac noreply at wordpress.org
Wed Jan 4 03:51:48 UTC 2017


#39457: Custom order of categories in Admin (post.php, post-new.php) broken in 4.7
--------------------------+-----------------------------
 Reporter:  lectest1      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Pre-4.7, this worked to order categories (and other taxonomies) in admin
 views such as the sidebar checklist at post.php and post-new.php, and the
 admin ‘Categories’ page, itself:

 {{{
 #!php
 // Order list of categories in admin views
     function my_sort_terms( $args ) {
             $args['taxonomies'] = array( 'category' );
             $args['order'] = 'DESC';
             $args['orderby'] = 'id';
             return $args;
     }
     apply_filters( 'get_terms_args', 'my_sort_terms', 10, 2 );
 }}}

 However, when I upgraded to WP 4.7, it stopped working.
 I’ve deactivated plugins on my main sites. I, then, tested on a stripped-
 down test site on 4.6 and 4.7 – same result. 4.7 stops this from working.
 Neither ‘add_filter’ nor ‘apply_filters’ works.

 How to fix? OR, in 4.7, how would you order categories/taxonomies by id on
 the admin side?

 Categories (and other custom taxonomies) are stuck in alphabetical (name)
 order in the admin.  What's needed is a way to order by id (and other
 properties).

 Result in 4.6 for the 'New Post' sidebar category list:

      April     (term id = 200 )
      March     (term id = 195 )
      February  (term id = 194 }
      January   (term id = 193 }

 Now, in 4.7 for the 'New Post' sidebar category list:

      April     (term id = 200 )
      February  (term id = 194 }
      January   (term id = 193 }
      March     (term id = 195 )


 Again, my test site has no non-core plugins, no custom functions, except
 for the above, and is running Twenty Sixteen theme.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39457>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list