It sounds like you’re looking for the get_term_link()
function.
Your code will look something like this:
<?php
$catid = get_sub_field('selected_category');
$term_link = get_term_link( intval( $catid ), 'product_cat' );
?>
<h4><a href="https://wordpress.stackexchange.com/questions/95584/<?php echo esc_url( $term_link ); ?>"><?php the_sub_field('title'); ?></a></h4>
As you can see, get_term_link()
takes two argument, the term and taxonomy. If you’re saving the term object in the field and passing it as the first argument, then the second argument is optional. If you pass the ID, as done above, then you have to pass the taxonomy name.
Related Posts:
- How to add images to taxonomies?
- Custom Taxonomy and Tax_Query
- How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?
- SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement
- Combine multiple custom user taxonomy in single url
- Advanced Tax Query
- Improving WP_Query performance for multiple taxonomies
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- How can I display all post IDs from the taxonomy?
- How to display custom taxonomy in multiple columns?
- Custom taxonomies making WP very slow – Way to fix?
- How to count the number of terms in a taxonomy
- Sorting taxonomy columns by meta value numeric
- Get Taxonmy Term ID For Current Post
- Display sub categories and their data of a taxonomy
- Advanced Query Logic With Multiple Taxonomies
- Display only first level children of my custom taxonomy categories
- Is it possible to get all term items from a custom taxonomy regardless of post attachment status?
- Changing stylesheet depending on custom taxonomy terms
- How do I taxonomy terms based on terms they are used alongside?
- Custom taxonomy [year] is directing to yearly archive
- Get posts by term slug only
- Taxonomies on custom taxonomies
- Add Custom Taxonomy for Blog Meta Info
- Search Tool only refreshes Page without showing results
- Getting associated taxonomies
- How to fetch the data from Advanced Custom post when we search specific keyword or field name related to the post?
- How to add images to taxonomy terms? [duplicate]
- one post per term taxonomy
- Show only the sub-categories (and their content) of the current custom taxonomy with ‘taxonomy.php’
- Using Advanced Custom Fields Relationship Field to select a taxonomy term
- Custom arguments in WP_Query
- check if a taxnomy queried in $wp_query?
- WP_Query tax_query – Show results if child has parent X
- Query custom taxonomy for category including children
- Variable Not Working Inside is_author() Array
- How to get related taxonomies based on a category with mysql query?
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Tracking the name of a custom taxonomy
- Add terms to a taxonomy archive from within the same taxonomy
- Is it possible to filter a taxonomy archive by other taxonomies that are on posts?
- Fill New Taxonomies
- Custom Taxonomies Archive Page 404
- WordPress taxonomy terms archive template help
- Make relation of custom taxomies
- List active taxonomy terms
- taxonomy query on front page
- How do you search for a post by custom taxonomy?
- Next/Previous links in custom taxonomy, where item may belong to multiple terms
- How to query authors by custom taxonomy?
- Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
- How to get multiple Taxonomies not All Taxonomies?
- WordPress Taxonomy Menu
- Primary Taxonomy for Post
- Get taxonomy image for Toolset custom taxonomy through Toolset Views Shortcode
- wp_get_object_terms count on taxonomies within an category archive
- List posts grouped by children of a custom taxonomy
- Make custom post type display with custom taxonomy in url
- Hook to filter based on form value and insert term
- Complex Taxonomy scheme
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Foreach for get_the_terms for hierarchical taxonomy don’t repeat Top Level Terms if contains multiple Second Level Terms
- Contact Form 7 – Populate Select List With Taxonomy [closed]
- How To Change Custom Taxonomy To Radio Buttons
- Page queried instead of a custom taxonomy
- Pros and cons of using [taxonomy name] in place of [category name]?
- drop-down list another query
- Echo taxonomy term meta on author.php
- custom taxonomy archive permalink shows 404 error
- is there any limit of length on creating custom taxonomies?
- WordPress renames slug of tags used in multiple taxonomies?
- How to get a list of taxonomy terms which are being used only within certain post types?
- Taxonomies: display hierarchical parent list
- Getting yoast title for custom taxonomy
- Permalinks for custom taxonomy stopped to work
- ‘Show on screen’ for custom taxonomies does not save
- get_category_link returning page URL
- Show preset taxonomy description
- Custom taxonomy not appearing in menu administration panel
- how can i display taxonomy instead of category on my web page?
- Taxonomy Meta Box in User Profile?
- How can I make front page to display custom taxonomy page?
- How to show post list based on taxonomy term?
- WordPress autocomplete search with taxonomies
- Display empty custom taxonomies differently than with one with posts
- remove term from custom taxonomy list
- Display taxonomy with a maximum number of letters
- Display Child Categories of Current Post ID
- Taxonomies specific to Page attribute template
- Echo ACF taxonomy field within a foreach for another taxonomy
- Keeping session instance of random display results over pagination breaks
- Infinite Scroll appending Next Product Category Term pages
- Listing Cities A custom taxonmy by selection order
- Count tags for current post and save into custom meta field (and update it on post edit)
- Limit Tag Links in Post Content
- Passing taxonomy id of taxonomy clicked on one page to another page
- Custom Taxonomy Not Being Recognized by is_tax()
- Why is it defaulting to “uncategorized” even after I select a custom taxonomy
- Get one custom taxonomy category
- Creating a page for custom taxonomy archive