How to filter by category name in custom post types?

Looking at the official wordpress documetation for WP_Query category https://developer.wordpress.org/reference/classes/wp_query/#category-parameters It should be something like $args = array( ‘post_type’ => ‘fruits’, ‘posts_per_page’ => 4, ‘category_name’ => ‘apple’ // category_name instead of category ); $query = new WP_Query( $args ); This is assuming you actually use the category and not custom taxonomy Also if actually refer … Read more