I am not sure how to fetch specific custom post type where taxonomy is for example february. Generally I'm trying to have custom data based on months.
Registering custom post type
add_action( 'init', 'plants' );
function plants() {
$args = array( labels and etc );
register_post_type( 'plants' , $args );
}
Registering taxonomy for custom post type
add_action('init', 'months');
function months() {
$args = array ( labels and etc );
register_taxonomy('months', 'plants', $args);
}
Fetching data
$args = array( 'post_type' => 'plants' );
$plants= new WP_Query($args);
if ($plants->have_posts()) : while ($plants->have_posts()): $plants->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php endif; ?>
So everything so far works, I get 3 items. But how do I fetch only items with specific taxonomy? Following doesnt do anything
$args = array(
'post_type' => 'plants',
'months'=>'february'
);