Random posts and filter issue

Hi everyone,

i used this code to display my listing post randomly

    add_action(
      'pre_get_posts',


      function($query){
	
        if(!is_admin() && 'hp_listing' === $query->get('post_type') && 'listings_view_page' ) {
          $query->set('orderby', 'rand');
		  
        }
      },
      1000
    );

It’s working but my filter is not working anymore.

With the code (button filter not working)

Without the code

Thank you for your help.

Hi,

Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features Support Policy | HivePress

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY

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