Remove all options from the sort by except the rating

Hi I basically removed all sorting options besides “ratings”
but by default it doesn’t sort anything it just shows a line


is it possible to remove this and the only option should be sort by “ratings”?
the benefit would be it would make the ratings more valuable.

Hi,

Please try using this snippet to remove options from the sort, below is an example of how to remove a price from the sort:

add_filter(
	'hivepress/v1/forms/listing_sort',
	function( $form ) {
		unset( $form['fields']['_sort']['options']['price__asc'], $form['fields']['_sort']['options']['price__desc'] );

		return $form;
	},
	1000
);

Is there any code snippet for this? I already removed all sorting options besides ratings
I want to make the only option should be sorting by ratings and this should be the one and only option by default

Hi,

Please provide more details on how you deleted the previous sort options. Because the example code snippet I provided is the best option, but you need to add other fields (like date, title, etc.) to make them completely hidden.

Yes I I did it through the code and it works well, and the only option I left to sort is by ratings, my problem is that by default as you can see on the screenshot


it doesn’t sort, and only when you click on it there’s an option of sorting by ratings, is it possible that by default it should sort by ratings and this should be the only option to sort?

Hi,

Unfortunately, there’s no such feature, it would require a custom implementation.

However, this feature is already on the roadmap and is planned for release in future updates.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.