I figured it out!
Using this code I was able to use my custom meta field as the link in the audio shortcode.
First I created a function in functions.php:
function audio_link() {
$terms = get_the_terms($post->ID, 'taxonomy-name');
$result = "";
if (is_array($terms) || is_object($terms)){
foreach ($terms as $term) {
$term_id = $term->term_id;
$result .= get_term_meta( $term_id,
'term-meta-field-name', true );
}
}
return $result;
}
Then I inserted the function into the shortcode like this:
<?php echo do_shortcode(''. audio_link() .'');?>
Hope this helps anyone else with this problem!
Related Posts:
- How to add ‘class’ attribute into shortcode [audio]?
- Audio or playlist shortcode condition according to the amount of files on attachment page
- Using audio shortcode for .mp3 URLs with a query string
- Changing playlist shortcode thumbnail sizes?
- Passing attributes to shortcode dynamically
- Remove HTML content if attribute is not set / variable attributes
- Legacy Audio Shortcode
- Extending the Audio Shortcode
- Are .MP3 files with capital letter extensions allowed in [audio] shortcode?
- Shortcodes and a list of IDs?
- no content after shortcode
- Reloading a Mediaelement audio player
- How can I implement shortcode on click event
- Displaying audio player as preview in audio post in WP3.6
- Turning variable into a value set in shortcode
- Substite Category Slug in a Shortcode
- How to add data attributes to the wordpress audio shortcode
- Check if parent page has child page of certain slug
- Is the WP audio shortcode still relevant?
- Variable inside shortcode or shortcode inside shortcode
- Multiple values for one variable
- WordPress core playlist function not showing artist and album info
- Class variables in shortcodes
- Shortcode with multiple variables
- About redundant code when I use shortcode to output the HTML from a variable
- Show shortcode without executing it
- How to create a shortcode with 1 parameter (atts)
- How does a shortcode work?
- Run visual composer code in php page
- Remove wptexturize from a shortcode?
- Using shortcode in Post title
- WP_enqueue_script inside shortcode?
- template_redirect to accompany with a shortcode
- Tinymce shortcodes within shortcode contents
- passing multiple parents value into a shortcode
- How do I preview the result of a shortcode in the TinyMCE editor?
- Raw output (preventing wpautop)
- Conditionally loading Facebook PHP SDK in shortcode
- WordPress shortcode doesn’t working on HomePage
- is_admin() returns false in save_post hook with Gutenberg editor
- Why are Shortcodes Disabled in Widgets by Default?
- Add attribute to shortcode dynamically
- Execute shortcode twice in the same page
- possibility to control embedded video timeline with buttons and links external to the player
- Add custom setting that uses radio button to WP Gallery
- Shortcode with hyphen doesn’t work
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- WordPress Shortcode show database row
- Shortcode “post_per_page” not working
- Shortcodes won’t work on live environment
- Create a short code to display a specific loop
- How to wp_redirect on ‘init’ hook on condition of current post id?
- Buddypress shortcode for tabs [closed]
- PHP Running On CMS Side of WordPress
- Basic do shortcodes question
- What is this format called (nested shortcodes)?
- Problem with height in video shortcode
- How to put a form with php code into a variable or shortcode?
- do_shortcode doesn’t work on some pages
- Best tools for preparing and styling a table [closed]
- When are Shortcode Attributes Available in Template
- Regenerating WordPress shortcodes based on value with AJAX
- Form shortcode with multiple options as attributes
- How can I insert a shortcode in the title tag of another?
- Shortcode inside text widget do not call enqueue style
- How to create a dropdown of shortcodes in edit mode for posts
- Metabox Keeps Stripping Parts of Shortcode
- Multiple instances of the shortcode on the same page
- Checking post content for a shortcode, but content is being returned as empty
- do_shortcode() won’t return PHP Array
- Shortcode and variable
- Excerpt Length & List Category Posts Plugin
- Show shortcode only in posts
- How to execute a shortcode?
- get_queried_object_id / short code returning blank
- How to remove double quotes in a shortcode?
- Shortcode to appear and show the date not code in Title and description of my website
- shortcode to display specific recent posts
- How to test If a post has a particular term
- wp_link_pages shortcode for ‘nextpagelink’
- How can I disable(remove) wpautop (wptexturize, convert_chars) for specific shortcodes only?
- Function in a wordpress shortcode
- Unable to make shortcode, what is wrong?
- How to display a page dependent on a url parameter supplied by a form/button page?
- Push Shortcode parameter to template
- WordPress plugin shortcodes not outputting anything
- WordPress Gallery with ID’s Shortcode not Working
- Featured image with link to post shortcode, image displaying above the post
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- How to add meta slider lite or other slider to main page header in pinboard theme
- shortcode change variable base on user
- Inserting shortcode is blanking excerpt – any ideas?
- Escaping a shortcode so it displays as-is [duplicate]
- If do_shortcode is blank, return some message
- Add a short code to a plugin
- Previous/Next with the same category
- I’ve broken the short code for Contact Form 7!
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode