$cat = get_the_category();

$curr_cat_id = $cat[0]->cat_ID;
$curr_cat_name = $cat[0]->name;

$taxonomy = (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])) ? $_REQUEST['taxonomy']:'';

$term = (isset($_REQUEST['term']) && !empty($_REQUEST['term'])) ? $_REQUEST['term']:'';

$args = array(
'post_type'=> 'post',
'category_name' => $curr_cat_name,
'order' => 'DESC',
'paged' => get_query_var('paged'),
'tax_query' => array ( array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $term,
) ),
);

$query = new WP_Query( $args );

Advertisements