[Closed] Disable sorting for Search (WordPress Archives)
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I'm currently using Toolset Block Editor to style my search results through the WordPress Archives functionality. However I can't find a way to disable sorting of the results and this is messing up the results order. Is there an option to disable sorting from Toolset's end or a field that can be used that won't change the order being passed on to Toolset?
Thank you for contacting us and I'd be happy to assist.
If you'd like to remove the front-end sorting controls, you can delete the block 'Sorting Controls' from the archive's blocks.
( example screenshot attached )
I might not have explained myself well. What I need to omit are the ordering options (even if this has to be done through functions.php). The results are being passed on by another plugin but then are being sorted/ordered by Toolset before being displayed (not on front-end).
Can you please share the name of the plugin that you're using to control the order of the posts? I'll test it on my website and suggest the next steps accordingly.
The client shared their solution using the API to modify the query sorting (linked to their use of another plugin they intend to influence the sorting):
Just in case anyone needs an answer to this, it has to be done programmatically by using the wpv_filter_query filter for views and the pre_get_posts action for archives as per examples below:
For particular views
==================
add_filter( 'wpv_filter_query', 'override_display_order, 101, 3 );
function override_display_order( $query_args, $view_settings, $view_id ) {
//use original order
if ( $view_id == 1) { //replace with your view ID
$query_args['orderby'] = 'post__in';
}
return $query_args;
}
For archives - example search archive
================================