You could do it using the term_link filter.
Something roughly as follows:
function my_term_link($termlink, $term, $taxonomy) {
global $post;
if ($taxonomy == 'my-custom-taxonomy') {
return get_permalink( $post->ID ) . '#' . $term->term_id;
}
}
while ( $programtype->have_posts() ) : $programtype->the_post();
$terms = get_the_terms( $post->ID, 'my-custom-taxonomy' );
add_filter('term_link', 'my_term_link', 10, 3);
foreach ($terms as $term) {
$link = get_term_link( $term, 'my-custom-taxonomy' );
// Use link here
}
remove_filter('term_link', 'my_term_link', 10, 3);
endwhile;
Related Posts:
- How to filter the taxonomy terms based on another taxonomy term
- How to Display Posts From Category Within a Custom Taxonomy?
- Display title of all custom posts from same taxonomy term on a custom post template
- How to get all posts related to a taxonomy?
- Filter By Term Not Working – Custom Post Type
- Custom Post Status & Taxonomies
- Get terms by taxonomy AND post_type
- Display current taxonomy term when inside custom post type
- Get term slug of current post
- How do I list custom taxonomy terms without the links?
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Get terms that contain posts that in turn belong to other terms?
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Custom Post Type Archive Template
- Custom permalinks – post type – hierarchical taxonomy’s
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Sort the main query in subcategories/terms?
- Display taxonomy term only if there’s a value
- Get list of terms of current taxonomy archive for another taxonomy
- Dynamically create/remove terms in taxonomy when custom post type is published/trashed
- How to get the first term for the current taxonomy?
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Show Two custom Post type and their posts on category page
- How to output wordpress custom tags separated by comma?
- get_the_terms return only last term
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Custom Post Type Archive Page Filtering
- Missing Posts in Custom Taxonomy List
- Show posts from two or more custom taxonomy terms
- Display post as term id
- Post count by month of taxonmy term
- How do I display the taxonomy for a custom post type in an array
- Display Custom Taxonomy Alphabetically
- Get terms that contain posts that in turn belong to other terms?
- Custom while loop for hierarchical display of a taxonomy
- Add term to custom post type on draft
- Listing all term items alphabetically / sorting loop
- WP the_posts() on single-cars.php get category link
- Variable not working in WP_Query
- Custom Post Types Archives and Single Pages not showing custom taxonomy data
- Shared terms between taxonomies
- Get_the_terms restrict output
- Get terms of a post but only if they’re also the child of a specific term
- How to get dropdown instance value in WordPress custom Widget
- Get taxonomy term by slug in post on archive page
- custom hierarchical taxonomy and custom post type list contains surplus posts
- How to display custom taxonomy term meta on custom post type
- Urls in Custom Post Type work for Terms but not for its Taxonomies
- does wp_insert_term link the term to a certain post ID?
- Copy/Move selected taxonomy terms to another taxonomy for posts
- List all posts in taxonomy term
- Grab all Custom Posts by multiple taxonomies and terms
- Add filter to Admin list for all custom post types by their custom taxonomies
- Add the custom post term to the custom post title
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Taxonomy terms with the same name are updated between separate custom post types
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Add a class to a div if custom post type has specific terms?
- Search CPT by tag ids
- Post template with breadcrumb needs to show page navigated from
- Custom taxonomy terms hierarchical navigation
- How to display custom taxonomy term specific post?
- What is the best way to structure posts for the same event happening in different years?
- Define multiple prefixes for custom post type
- How to list posts by terms
- How to order taxonomy terms by most recent post?
- How to associate custom taxonomy terms with custom post type?
- get_queried_object not work in taxonomy page
- get_the_terms child terms for current post/custom post only
- I cannot display custom posts in custom taxonomy
- How can I get the last 5 element of this tax query?
- Pages of my taxonomy terms are showing all posts
- wordpress does not see the correct custom taxonomy hierarchy
- How to show terms used only for particular custom post type. Filter creation perpose
- Custom taxonomy- only output relevant terms
- order taxonomy alphabetical
- Filter Term By Parent Term – Custom Post Type
- Display all Custom taxonomy terms and their relevant custom posts
- WordPress get all post with like in terms [duplicate]
- Decrement term in for each
- Best way to group posts based on custom post type terms
- How to pass taxonomy terms to WP_Query along with $args?
- Prevent repetitive terms in get_the_term_list
- Post Editor: display categories from current post type taxonomy only?
- How to retrieve the permalink for a specific (custom) term?
- Get term_id for each instance of custom taxonomy
- List a custom taxonomy’s terms, with links, on the taxonomy page
- install.php Custom Taxonomy Term not being added to custom post
- Custom My account page and custom page for editing posts
- show 10 most recent custom post types excluding the one(s) from specific custom taxonomy
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- Get custom post type parent category
- How to manage a bookstore
- Sort ACF by custom taxonomy
- Taxonomy Archive URL + Template