Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}

$combined_views = (int)$get_visit_query + (int)$offset; This doesn’t make much sense. $get_visit_query is a string (your query). Converting it to int returns in 0, see this snippet. Instead it should be $combined_views = (int)$visits_total + (int)$offset; Sidenote: Are you actually hooking the function via add_filter()? If not, apply_filters(‘get_post_views’, ..) will not have the desired effect. Using … Read more

order the meta query results by 2 custom fields

You forgot to use relation in meta_query . I think this will work: $args = array( ‘post_type’ => ‘brewery’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘review_rating_meta’ => array( ‘key’ => ‘review_rating’, ), ‘reveiw_count_meta’ => array( ‘key’ => ‘reveiw_count’, ), ), ‘orderby’ => array( ‘review_rating_meta’ => ‘DESC’, ‘reveiw_count_meta’ => ‘DESC’, … Read more

Order by the first array within a meta_query

You can use get_posts() for both event types and merge them. $merged_events = array(); $upcoming = get_posts(array( /* Your upcoming events args here. */ )); $past = get_posts(array( /* Your past events args here. */ )); $merged_events = array_merge( $upcoming, $past); foreach( $merged_events as $merged_event ) { //Your loop }

How using the Meta Box plugin, to filter posts by the value of a post type field?

I’m not familiar with the Meta Box plugin or it’s capabilities (and please note that third-party products are considered off-topic here!) – but regarding the question in the scope of core WordPress alone… For clarity’s sake, I envision the lessons_teacher meta-value to look similar to [[‘post_name’ => ‘john_smith’], [‘post_name’ => ‘jane_doe’]] SQL – and by … Read more