I'm trying to do a post sort based on a premade list I have, and am wondering how to disable the default wordpress sorting (and if I'm doing this right at all).
I'm displaying heaps of posts on the main page. I fetch post ids from a secondary table with the $wpdb var (with ORDER BY specified there). I'd like to be able to tell wordpress to display my fetched id array exactly as is - display only the things in that array, and display them in that order. I'm trying to patch this without changing too much, as I already have a few plugins (by which I mean that a direct query / main loop modification is out), so I'm using a filter for pre_get_posts.
From what I've seen, I can tell wordpress to display my id array with:
$query->query_vars['post__in'] = $myPostIds ;
That's good. However, I assume that the order of the myPostIds array will get trashed. Would turning the sorting off do the trick, and is that even the right idea? I could do something like:
$query->query_vars['orderby'] = "" ; // or null
(not sure if that works, that's just a guess)
I would like to know how to get this to sort properly. If there are methods that would do this, fantastic. Or, if anyone can tell me that I'm totally wrong on this whole method, that would be great too.
Thanks for the help!