I've fixed some stupid errors and checked the $query_arg manualy. It is as it should be.
However, the VIEW takes its ordering from the selection at the VIEW panel. The default is Post Title.
Is there a way to overwrite it?
$query_args['orderby'] = 'post__in';
This should override the orderby settings applied in the View editor. Assuming the order is correct in the $arts array, I would expect this to work correctly.
- Can you confirm there is no secondary sorting applied in the View editor?
- Can I see the complete wpv_filter_query code?
- Check the View shortcode for the Arts View, to be sure orderby is not applied as a shortcode attribute.
- If there are any Query Filters in the Arts View, please toggle those open and take a screenshot so I can see the filter settings. Include that screenshot in your next reply.
- If you have any other custom code snippets, disable them temporarily while testing to ensure there is no interference.
- Temporarily activate a default theme or your parent theme to be sure there is no code in your custom theme interfering in sort order here.
- Temporarily disable any other 3rd-party plugins while testing to be sure they are not interfering with sort order here.
I have done all you suggested. All the snipers and plugins, except the relevant ones, are all the are deactivated. I have made a new view with no filters what so ever and made sure there is no secondary spring or anything in the short code. I changed to the original unmodified theme. Alas the sorting is being taken from the primary sorting order in the VIEW.
So I’ve uploaded this new version onto the same place. Please send me a secure request and I’ll send you your password and the URL’s of the relevant pages.
To ensure that I understand fully right now. You are using the custom code to sort the view alphabetically but this currently isn't working ? hidden link
Yes correct! The order is stored in array $query_args['post__in'] ; which is in correct order. The parameter to use the ordering stored in $query_args['post__in'] is set by $query_args['orderby'] = 'post__in'; which is also correct but the ordering isn't working as I explaied in the private message to Christian of August 19th
No it hasn't! It's what it was doing all along. The first 3 posts ID's, for example, in the the $query_args['post__in'] are: ["post__in"]=> array(137) { [0]=> int(246723) [1]=> int(246582) [2]=> int(246639) ...
while the first 3 posts actually being displayed in the view are: 246774, 246770, 246772...
What you say is correct in that the post ordering on the view pannel is overriding the ordering in the $query_args['post__in'] . This is the very problem I have been dealing with. You just set the ordering by Post Title. I don't want that I want it ordered as per $query_args['post__in'] which is aphabetically by the artist surname. and according to the Christian advise as well as WP_Query documentation setting $query_args['orderby'] = 'post__in should do that but it doesn't!