Thursday, August 18, 2022
WordpressWordpress Tricks

How to Get WordPress post by Taxonomy Category id?

Wordpress trick to check term id has parent term or child term

Hello to all, welcome to In this post, I will tell you, How to Get WordPress post by Taxonomy Category id?

If you are new in wordpress then you can check my post related to WordPress.

In these day, I am busy with other programing things like Laravel, Vue and Angular.

But I can still say, WordPress is my favorite.

Here I am going to show code snippet for How to Get WordPress post by Taxonomy Category id?:

1. Here is the code and you can add into any of your wordpress them’s template:

$catid = get_term_by( 'slug', 'cat-slug', 'Taxnomyname' );
$args = array(
'posts_per_page'   => -1,
'offset'           => 0,
'tax_query'  => array(array(
'taxonomy' => 'Taxnomyname',
'field' => 'term_id',
'terms' => $catid->term_id
'orderby'          => 'date',
'order'            => 'DESC',
'post_type'        => 'match',
'post_status'      => 'publish'
$events = get_posts( $args );


If you have any query related to this post, then do comment below or ask question.


Thank you

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 7, Angular 8, Angular 9, Angular 10, Angular 11, Angular12, Angular 13, Angular 14, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.