Call Us : +1-678-551-2452
+91 77381-86899

Search Result of Ultimate Query Search Filter Plugin not being sorted by Meta Key

I am using the plugin https://wordpress.org/support/plugin/ultimate-wp-query-search-filter for Search by form input in a Wordpress website. Everything worked fine except the search results were not being sorted by the Meta Key in spite of configuring the settings for the same. Later I found this was due to the presence of the ‘Post Type Order’ plugin on the website, which was activated for doing custom sorting of other posts.

My solution for the remove Custom Sorting only in the Search results. Below is the solution:

Open file ultimate-wp-query-search-filter/classes/uwpqsf-process-class.php

Find function  uajax_result($arg, $id,$pagenumber,$getdata) and add below line of code

remove_filter(‘posts_orderby’, ‘CPTOrderPosts’, 99, 2); (before the line: $query = new WP_Query( $arg );)

Then add the filter back after while loop (before the line $html .= $this->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id,$getdata);)

For other queries to be sorted according to post type order plugin:

add_filter(‘posts_orderby’, ‘CPTOrderPosts’, 99, 2);

 

Leave a Reply

Pay with PayPal

Icon Web Solutions Service
Other Amount:
Name:

Testimonials

It has been a great pleasure working with Icon Web Solutions on the development of my digitized logo and website. From the initial phases of web design, the Icon Web Solutions team has been a pleasure to work with
Naren, USA

REQUEST A QUOTE

Request A Quote

Please fill the form to request a quote from us

Name (required)

Email (required)

Phone

Services
 Website Design & Development Logo Design SEO SMO Payment Gateway Integration Others

Any Other Detail

Input Text Shown in Image
captcha