Home Wordpress Get Wordpress Post with Tag Id working example

Get Wordpress Post with Tag Id working example

by therichpost
0 comments
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

You may also like

Leave a Comment

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