Title: Adept query
Last modified: June 2, 2025

---

# Adept query

 *  Resolved [timothy12](https://wordpress.org/support/users/timothy12/)
 * (@timothy12)
 * [1 year ago](https://wordpress.org/support/topic/adept-query/)
 * How can I change this query so it only shows posts with the yoast primary category‘
   prezi’ or ‘kahoot’?
   `<?php // the query $the_query = new WP_Query(array( 'post_type'
   => 'post' , 'posts_per_page' => 3, 'post_status' => 'publish', 'category_name'
   => 'prezi, kahoot', 'orderby' => 'rand', 'order' => 'asc', )); ?>
 * Kind regards,
   Timothy

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [timothy12](https://wordpress.org/support/users/timothy12/)
 * (@timothy12)
 * [1 year ago](https://wordpress.org/support/topic/adept-query/#post-18493521)
 * This snippet shows all posts with their yoast primary category. What do I have
   to add to get only the posts with the primary category ‘Prezi’ or ‘Kahoot’?
 *     ```wp-block-code
       $primary_term = get_post_meta(get_the_ID(), '_yoast_wpseo_primary_category', true);$the_query = new WP_Query(array(    'post_type' => 'post',    'posts_per_page' => 3,    'post_status' => 'publish',    'category_name' => $primary_term,    'orderby' => 'rand',    'order' => 'asc',));
       ```
   
 *  Plugin Support [Maybellyne](https://wordpress.org/support/users/maybellyne/)
 * (@maybellyne)
 * [1 year ago](https://wordpress.org/support/topic/adept-query/#post-18500044)
 * Hello Timothy,
 * Thanks for reaching out but your question goes beyond the technical expertise
   of the Yoast support team. Therefore, we can’t give you a solid answer to your
   question.
 * But we don’t want to leave you empty-handed. Our developer portal at [developer.yoast.com ](https://developer.yoast.com/)
   has proven helpful to many developers in the past and hopefully will serve you
   well too.
 * Sorry, we can’t be of more help here.
 *  Thread Starter [timothy12](https://wordpress.org/support/users/timothy12/)
 * (@timothy12)
 * [1 year ago](https://wordpress.org/support/topic/adept-query/#post-18505360)
 * [@maybellyne](https://wordpress.org/support/users/maybellyne/) Thanks for your
   reply and the suggestion for the developer portal. I will think about it. For
   now, I’ve found a solution that works, but it is not the best one. That would
   be the adepted query.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adept query’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

## Tags

 * [query](https://wordpress.org/support/topic-tag/query/)

 * 3 replies
 * 2 participants
 * Last reply from: [timothy12](https://wordpress.org/support/users/timothy12/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/adept-query/#post-18505360)
 * Status: resolved