Hello to all, welcome to therichpost.com. 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.
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.
You Might Also Like
Hello to all and welcome on therichpost.com. In this post, I will tell you, How to add custom field in...