Home›Types Community Support›[Resolved] Cannot Sort Fields On Edit All Posts Dashboard Page (/wp-admin/edit.php)
[Resolved] Cannot Sort Fields On Edit All Posts Dashboard Page (/wp-admin/edit.php)
The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This thread is resolved. Here is a description of the problem and solution.
Problem: Sorting by date does not appear to work as expected in the wp-admin area for a custom post type.
Solution: Adjust theme files if necessary to make sure Admin pages are not effected (!is_admin()) by sorting options set for the front-end.
//Plants Archive Page Sorting
function plants_archive_change_sort_order($query) {
if (!is_admin() && is_post_type_archive('plants')) {
//Set the order ASC or DESC
$query->set( 'order', 'ASC' );
//Set the orderby
$query->set( 'orderby', 'name' );
}
}
add_action( 'pre_get_posts', 'plants_archive_change_sort_order');
Relevant Documentation:
This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
I expected to see: The posts in order of date, descending.
Instead, I got: Default sort.
On my dev environment with only Types installed as a plugin, this still happens. I have a code-based custom post type, "Gifts". This post type does not have the same issue.
I'm not sure what is causing the issue here but would you mind if I install the duplicator plugin and create a duplicator package of this website for further testing ?
Hi, Shane is off today so I will take over this ticket. I hope that's okay. If I temporarily enable a default theme, like Twenty Seventeen, sorting of Plants works as expected. Can you confirm this behavior on the staging site? If you agree, then it seems we have a theme compatibility issue.