wordpress get taxonomy of a post
<?php $term_obj_list = get_the_terms( $post->ID, 'taxonomy_name' ); ?>
wordpress get taxonomy of a post
<?php $term_obj_list = get_the_terms( $post->ID, 'taxonomy_name' ); ?>
get posts by custom taxonomy wp_query
$the_query = new WP_Query( array(
'post_type' => 'Adverts',
'tax_query' => array(
array (
'taxonomy' => 'advert_tag',
'field' => 'slug',
'terms' => 'politics',
)
),
) );
while ( $the_query->have_posts() ) :
$the_query->the_post();
// Show Posts ...
endwhile;
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata();
get term id by post id
INSIDE TAXONOMY PAGES
$term = get_queried_object();
$term_id = $term->term_id;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us