making a search.php query

You are missing the search parameter in your arguments. The code below, when added to the array in $the_query, should pass along the query string variable from a search: ‘s’ => $s Documentation is available here: https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter

Showing most popular post of week

This is not how you collect view stats over period of time. The right way to do it is to have some sort of sliding window that will help you calculate views over specific time frame. For example to get the most popular post “today” you store the counts in an option, and zero the … Read more

The most recent post of custom taxonomy

Because your posts_per_page has a value of -1 means return all matching query. You should update your post_per_page to 1 and specify the order, and orderby parameters. Order the posts by date in descending order. $featured_value_cat_query = new WP_Query( array ( ‘post_type’ => ‘values’, ‘posts_per_page’ => 1, ‘orderby’ => ‘date’, // ‘order’ => ‘DESC’ … … Read more

Speed up WP_query with meta comparing dates

Can you upgrade your hosting? I’ve had a very similar query running on AWS that is fine with 1700 events and meta_query that also had location. Another option for you (if it’s always the same query i.e. today as your queried date) is to use transients to store the result. $events_arr = get_transient(‘events_running_today’); if (!$events_arr) … Read more