[wp-trac] [WordPress Trac] #34825: Impossible to set a default ordering for custom post types (on the admin screen)

WordPress Trac noreply at wordpress.org
Wed Dec 2 04:16:31 UTC 2015


#34825: Impossible to set a default ordering for custom post types (on the admin
screen)
-------------------------------------------------+-------------------------
 Reporter:  stephenharris                        |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  4.4
Component:  Posts, Post Types                    |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests needs-    |     Focuses:
  testing                                        |  administration
-------------------------------------------------+-------------------------
Description changed by SergeyBiryukov:

Old description:

> In the patch for #25493, (specifically
> https://core.trac.wordpress.org/changeset/34728), when an `orderby` value
> is not set in `$_GET` it defaults to 'date'. This was corrected for
> hierarchical post types in
> https://core.trac.wordpress.org/changeset/35482 after it was noted that
> date should not be the default ordering for pages.
>
> However, non-hierarchical custom post types are also having their default
> ordering set to (publication) 'date', and this may not be the natural
> ordering (e.g. events).
>
> Previously, you could specify a default ordering by checking
> `$query->get('orderby')` and assigning that property a value if it were
> empty. That's no longer possible as it will now return 'date', when no
> orderby has been set.
>
> We should check the actual post type at this line:
> https://github.com/WordPress/WordPress/blob/fc349932c0d1995603fe3f24953318c4c925390e
> /wp-admin/includes/post.php#L1011 rather than whether its non-
> hierarchical and/or provide a means for a post type to determine its own
> default ordering.

New description:

 In the patch for #25493, (specifically [34728]), when an `orderby` value
 is not set in `$_GET` it defaults to 'date'. This was corrected for
 hierarchical post types in [35482] after it was noted that date should not
 be the default ordering for pages.

 However, non-hierarchical custom post types are also having their default
 ordering set to (publication) 'date', and this may not be the natural
 ordering (e.g. events).

 Previously, you could specify a default ordering by checking
 `$query->get('orderby')` and assigning that property a value if it were
 empty. That's no longer possible as it will now return 'date', when no
 orderby has been set.

 We should check the actual post type at this line:
 https://github.com/WordPress/WordPress/blob/fc349932c0d1995603fe3f24953318c4c925390e
 /wp-admin/includes/post.php#L1011 rather than whether its non-hierarchical
 and/or provide a means for a post type to determine its own default
 ordering.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34825#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list