Sort order for archive of custom post type
-
How can I change the sort order for my custom post type archive using pre_get_posts, when the SQL would be:
ORDER BY wp_postmeta.meta_value ASC, wp_posts.ID DESC
if( ! is_admin() && is_post_type_archive('fsbo') && $query->is_main_query() ) { $query->set( 'orderby', 'wp_postmeta.meta_value ASC, wp_posts.ID DESC' ); }
The sort order is not right when I use this.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Sort order for archive of custom post type’ is closed to new replies.