wp_query beginner

After you create your custom query, you just write The Loop as you would for the default query. So your code would look like this: if ( $query->have_posts() : while ( $query->have_posts() ) : $query->the_post(); // Your Post Stuff Goes Here endwhile; wp_reset_postdata(); else : // No Posts Found Code Goes Here endif; Note the … Read more

Related Post by Tags Code

So, if I’m reading your code correctly, you are trying to dump all the current posts’ tag IDs into your tag__in array. My only hesitation is I’m not sure exactly how the query returns the order, if it’s just done by post date or actual tag relevance. That should look something like this: if ( … Read more

in tax_query this Is the code correct? I need to access beginner video posts for different subject

try this.. $args = array( ‘post_type’ => ‘videolesson’, ‘ordeby’ => ‘rand’, ‘order’ => ‘DESC’, ‘posts_per_page’ => 8, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘level’, ‘field’ => ‘slug’, ‘terms’ => ‘beginner’, ‘compare’ => ‘IN’, ), array( ‘taxonomy’ => ‘subjects’, ‘operator’ => ‘EXISTS’ ) ), ); $getting = new WP_Query( $args );