WordpressWordpress Tricks

Get WordPress Post with Tag Id working example

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

Hello to all, welcome to therichpost.com. In this post, I will tell you, How to Get WordPress Post with tag id working example.

I personally like WordPress very much and you can find many post related to WordPress Tricks, WordPress Hooks, WordPress.

Every day, I face new challenge in WordPress.

Today I am going to share to simple but tricky code to get WordPress Post with Tag Id:

1. Here is the working code and you can this into your WordPress theme’s template file:

$query = new WP_Query( array(
'post_type' => 'gd_place',
'tax_query' => array(
array (
'taxonomy' => 'gd_place_tags',
'field' => 'term_id', // term_id, slug or name or I can say tag id
'terms' => 187,
) );
while ( $query ->have_posts() ) :
$query ->the_post();



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

Jassa Jatt,

Thank you

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, Angular 8, Angular 9, Angular 10, Angular 11, Nodejs, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

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