Different query result on local and server

Can you try using another date format? Example: foreach ($blogs AS $blog) { switch_to_blog($blog[“blog_id”]); $yesterday_today = array( ‘order’ => ‘ASC’, ‘orderby’ => ‘date’, ‘date_query’ => array( array( ‘after’ => array( ‘year’ => date(‘Y’,strtotime(“-1 days”)), ‘month’ => date(‘n’,strtotime(“-1 days”)), ‘day’ => date(‘j’,strtotime(“-1 days”)), ), ‘before’ => array( ‘year’ => date(‘Y’), ‘month’ => date(‘n’), ‘day’ => date(‘j’), … Read more

show loop id post , only first id can read

You are getting the option “blog-featured-post”, which apparently returns two posts. Then, for each of these posts, you are making a query. Only the second one is actually used, since your if ( $q->have_posts() ) is outside of the loop. This query only has one post, since you use the post ID with the post__in … Read more

Meta query not showing result properly

You are missing relation argument for inner meta_query arrays as described in the Code Reference. Also, when you use ‘compare’=> ‘IN’, the ‘ship-from’ value should be the array. $args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( ‘relation’ => ‘AND’, // note this! array( ‘key’ => ‘ship-from’, ‘value’ => ‘usa’, ‘compare’=> ‘IN’ ), array( ‘key’ … Read more

Custom Post Type WP_Query with filters and search

This is what I ended up with: $specialty_terms = get_terms(‘specialty’); $specialty_term_ids = wp_list_pluck($specialty_terms, ‘slug’); $location_terms = get_terms(‘locations’); $location_term_ids = wp_list_pluck($location_terms, ‘slug’); if( isset($_GET[‘docname’]) ): $name_search = $_GET[‘docname’]; else: $name_search = “”; endif; if( isset($_GET[‘specialty’]) && $_GET[‘specialty’] !== ”): $specialty = $_GET[‘specialty’]; else: $specialty = $specialty_term_ids; endif; if( isset($_GET[‘location’]) && $_GET[‘location’] !== ”): $location = $_GET[‘location’]; … Read more