How to get custom post type by custom category in wordpress

We can get custom post type by custom category by custom category in many ways. One of method of getting custom post type define below:-

To get the custom post type by custom category in WordPress you need to do something like below code.

$the_query = new WP_Query( array(
'post_type' ='portfolio',
'tax_query' =array(
array (
'taxonomy' ='technology',
'field' ='slug',
'terms' ='wordpress',
)
),
) );
while ( $the_query->have_posts() ) :
$the_query->the_post();

// Show Posts ...

endwhile;
wp_reset_postdata();

Post Created 39

Leave a Reply

Related Posts

Begin typing your search above and press enter to search. Press ESC to cancel.

Back To Top