I take it you’ve gotten as far as being able to sort the column by the ID meta_key? Done by adding query vars in the ‘request’ filter, right? From there we’re limited to setting query vars that could have been defined as arguments to new WP_Query objects. AFAIK, you cannot sort by manufacturer name (as you’ve described the relationship) by using WP_Query arguments alone, it’s one level of abstraction beyond WP_Query’s capabilities. If you could, it’s then a matter of setting the same query vars as you would for WP_Query.
I’d be surprised if it’s that simple. In a regular query to sort by manufacturer name, as I see it, we would need to hook into the ‘posts_*’ filters of $wp_query->get_posts() and join in the tables necessary to relate manufacturer name to the ID. I’m assuming the name to ID relationship exists in the DB in some manner, yes? If not, this sort is truly not possible. If yes, I believe we can still hook into the ‘posts_*’ filters to modify the query as needed for column sorts just as we do for regular queries of the same type. You can still check for your column name in the ‘orderby’ query var just as you would in the ‘request’ filter.
I’ve not ever hooked ‘posts_*’ filters for a column sort query, but I believe it is a viable approach. Good luck!
I have the manufacturer ID sved in the post_meta table so it’s possible for it to be retrieved. I’m not sure about the filters that you’ve said, so I’ll have to see just what I can do. I’d need to join the tabl esomehow, and that’s where I’m a bit stuck. I could do this in plain SQL in seconds, but trying to work in with the query object… not quite so easy from what I’ve seen.
Yeah, that’s the thing, I don’t think it’s possible to get the joins you need through the WP_Query object. (Do take a look though, it’d be better if you could) That’s where the ‘posts_*’ filters (starting line 2602 of query.php) come in. Another thing you could do is a wholesale SQL query replacement via ‘posts_request’. Then the query vars are a mere stand in and have no effect on the results. A shame to go through all the parse query code just to throw it out and paste in something else, but I can’t imagine any way to bypass that without re-doing the list table class.