WordpressWordpress Tricks

Get WordPress Post with Tag Id working example

wordpress
509Views

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();
the_title();
endwhile;

 

 


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 full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

Positive SSL