Categories

Friday, November 22, 2024
#919814419350 therichposts@gmail.com
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();
the_title();
endwhile;

 

 


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

Jassa Jatt,

Thank you

therichpost
the authortherichpost
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 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

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