admin管理员组

文章数量:1122846

I have two functions for query filter:

function my_query_filter_most_views( $query ) {
    $query->set( 'orderby', 'meta_value_num' );
    $query->set( 'meta_key', 'entry_views' );
    
    $query->set( 'order', 'DESC' );
}
add_action( 'elementor/query/custom_filter', 'my_query_filter_most_views' );

function my_query_filter_most_views1( $query ) {
    $tax_query = array(
            array(
                'taxonomy' => 'filter',
                'field'    => 'slug',
                'terms'    => 'trending',
            ),
        );
        $query->set( 'tax_query', $tax_query );
}
add_action( 'elementor/query/custom_filter1', 'my_query_filter_most_views1' );

I want to combine these two functions, query filter as one, through which I want to show posts that have views and also show the posts that may or may not have views but have 'trending' as a term. It is working correctly as separate functions, but I am unable to achieve both when combined.

本文标签: phpShow post in elementor based on views and specific category with query id feature in elementor