Get WordPress Post with Tag Id working example

·

,
wordpress

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