Forums › Forums › Search & Filter Pro › Filtering – Edit Query Arguments
Tagged: filtering
- This topic has 3 replies, 2 voices, and was last updated 9 years, 9 months ago by
Anonymous.
-
Anonymous(Private) February 11, 2017 at 2:03 am #89484
Hello,
I am having some issue with the filtering. I am trying to add an argument that will list my posts in order of date in descending order. Here is what I’ve come up with:
function filter_function_name( $query_args, $sfid ) { //if search form ID = 225, the do something with this query if($sfid==334) { $query_args = array( 'meta_key' => 'webinar_date', 'orderby'=> 'meta_value', 'order' => 'DESC' ); } return $query_args; } add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );But it comes up with no result with the above. Could you please help me with this.
Thanks in advance
Trevor(Private) February 13, 2017 at 3:24 pm #89774Sorry, whilst I can sometimes work on weekends, our official hours are UK time 10am to 5pm Monday to Friday (excluding National Holidays). By replying to your own thread you bumped it further down the queue, otherwise it would have been answered hours ago.
This webinar_date is a meta key and not the post date? In the form, there is a sort order option on the Posts tab, where you can specify a meta key as the sort order.
Did you try that first? In what format is the date saved into the database? This will be key in determining of a sort will work as expected. So-called ACF format is required (so today would be 20170213).
-
AuthorPosts