Specific Filter Not Working With Custom Orderby
-
Hi again,
I’ve run into a small issue and hopefully you can point me in the right direction again.
The PRICE filter – from an ACF Field – does not work because the POSTS are ordered by the PRICE.
Below is the function on how the archive is being ordered:
function wpb_custom_query( $query ) { if( $query->is_main_query() && ! is_admin() && $query->is_archive() ) { $query->set( 'meta_key', 'price' ); $query->set( 'orderby', 'meta_value_num' ); $query->set( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'wpb_custom_query' );
Like I said, all the other filters work fine, but for some reason the PRICE filter is not working and I presume its because of how I am ordering the posts.
Many thanks in advance! Any help will be greatly appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Specific Filter Not Working With Custom Orderby’ is closed to new replies.