object terms
// Add Shortcode function custom_php_shortcode() { $post_terms = wp_get_object_terms( $post->ID, 'post_tag' ); $output = '<ul>'; if ( ! empty( $post_terms ) ) { if ( ! is_wp_error( $post_terms ) ) { foreach( $post_terms as $term ) { $output .= '<li><a href="' . get_term_link( $term->slug, 'product' ) . '">' . esc_html( $term->name ) . '</a></li>'; } } } $output .= '</ul>'; return $output; } add_shortcode( 'customphp', 'custom_php_shortcode' );