Title: Using ACF fields in player shortcode
Last modified: October 10, 2021

---

# Using ACF fields in player shortcode

 *  Resolved [dazman88](https://wordpress.org/support/users/dazman88/)
 * (@dazman88)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/using-acf-fields-in-player-shortcode/)
 * Hi,
 * Im trying to build custom post type which will output all player shortcode attributes
   wrapped in the player shortcode. Im using ACF to store and output attributes 
   such as:
    feed_url apple_sub google_sub
 * and so on,
 * my issue is how to output these values into a short code. I have tried nesting
   acf shortcodes within the podcast player short code like this:
 * [podcastplayer feed_url=”[acf field=”feed_url”]”] but it does not work, I get
   a “RSS Error: Please provide a valid URL” – I have checked that parsing the naked
   acf field shortcode [acf field=”feed_url”] does output the RSS feed correctly,
   so this is just an issue of nesting shortcodes, if that is even possible.
 * Would like to know if there’s a way to get this working.
 * Much appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Veda](https://wordpress.org/support/users/vedathemes/)
 * (@vedathemes)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/using-acf-fields-in-player-shortcode/#post-14963301)
 * Hi there,
 * 1. shortcodes within shortcodes will not work. WordPress does not support this.
   
   2. Podcast player does support custom field for feed URL. You just need to do
   following,
 * `[podcastplayer feed_url="acf_field_name"]`
 * 3. subscription option does not support ACF field. However, we need some custom
   solution for this.
 * Inform me for more help on this.
 * Thanks,
 *  Plugin Author [Veda](https://wordpress.org/support/users/vedathemes/)
 * (@vedathemes)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/using-acf-fields-in-player-shortcode/#post-14967015)
 * Hi [@dazman88](https://wordpress.org/support/users/dazman88/) ,
 * I have created a custom function for you to fetch spotify, apple and google links
   from ACF fields.
 * 1. Copy and paste following PHP function in [code snippets](https://wordpress.org/plugins/code-snippets/)
   free plugin. You can also paste it at the end of your theme’s function.php file
   but it is lot more complicated and unsafe.
 *     ```
       add_filter(
       	'podcast_player_shcode_display',
       	function( $args ) {
       		$temp = array(
       			'apple-sub'   => $args['apple-sub'],
       			'google-sub'  => $args['google-sub'],
       			'spotify-sub' => $args['spotify-sub'],
       		);
   
       		foreach ( $temp as $key => $val ) {
       			$scheme = strtolower( wp_parse_url( $val, PHP_URL_SCHEME ) );
       			if ( in_array( $scheme, array( 'http', 'https' ), true ) ) {
       				continue;
       			}
       			// Check if url has been provided in as a custom field.
       			$custom_keys = get_post_custom_keys();
       			if ( $custom_keys && in_array( $val, $custom_keys, true ) ) {
       				$murl = get_post_custom_values( $val );
       				$murl = is_array( $murl ) ? $murl[0] : $murl;
   
       				$scheme1 = strtolower( wp_parse_url( $murl, PHP_URL_SCHEME ) );
       				if ( in_array( $scheme1, array( 'http', 'https' ), true ) ) {
       					$args[ $key ] = wp_strip_all_tags( $murl );
       				}
       			}
       		}
       		return $args;
       	},
       	12
       );
       ```
   
 * 2. Now let’s assume your ACF field name are as follows, acf_url, acf_apple, acf_google,
   acf_spotify. You can create a shortcode like this,
 * `[podcastplayer feed_url="acf_url" spotify_sub="acf_spotify" google_sub="acf_google"
   apple_sub="acf_apple"]`
 * You need to use actual acf filed name here.
 * Note: Using custom PHP code might break your site if pasted incorrectly. Please
   backup your site and use code snippet plugin to do it safely.
 *  Plugin Author [Veda](https://wordpress.org/support/users/vedathemes/)
 * (@vedathemes)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/using-acf-fields-in-player-shortcode/#post-14975443)
 * Hi [@dazman88](https://wordpress.org/support/users/dazman88/) ,
 * Did the above solution work for you? Do you need any more help?
 * Thanks,
 *  Plugin Author [Veda](https://wordpress.org/support/users/vedathemes/)
 * (@vedathemes)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/using-acf-fields-in-player-shortcode/#post-14986814)
 * Hi there,
 * I hope the issue has been resolved. Therefore, I am closing the ticket. However,
   feel free to comment on this ticket or create a new ticket if you need any more
   help with podcast player.
 * Thanks,

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Using ACF fields in player shortcode’ is closed to new replies.

 * ![](https://ps.w.org/podcast-player/assets/icon-256x256.png?rev=2622629)
 * [Podcast Player - Your Podcasting Companion](https://wordpress.org/plugins/podcast-player/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/podcast-player/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/podcast-player/)
 * [Active Topics](https://wordpress.org/support/plugin/podcast-player/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/podcast-player/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/podcast-player/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Veda](https://wordpress.org/support/users/vedathemes/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/using-acf-fields-in-player-shortcode/#post-14986814)
 * Status: resolved