Title: adding tags to caption
Last modified: August 20, 2016

---

# adding tags to caption

 *  [bitsybride](https://wordpress.org/support/users/bitsybride/)
 * (@bitsybride)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adding-tags-to-caption/)
 * I’m sprucing up my image captions and trying to combine your media tags with 
   another plugin that adds a custom field to captions. It’s my way of hacking to
   the answer because I’m a novice. See the work in progress here: [http://bitsybride.com/test/](http://bitsybride.com/test/)
 * I have it all set up and just need to make that display_item_callback function
   work, but I’m not that familiar with functions. I was trying to combine it with
   another function that sets up the formatting for the caption. I’m sure you will
   be horrified, but here is my failed attempt:
 *     ```
       add_filter( 'img_caption_shortcode', 'wp_image_credit_img_caption_shortcode', 10, 3 );
       function wp_image_credit_img_caption_shortcode($attr, $content, $html){
   
       	$content = (object)$content;
       	$credit = wp_image_credit_get_credit_link(substr($content->id, strpos($content->id, "_") + 1));
       	$mediaTags = get_attachments_by_media_tags();
   
       	$result = <<<END
       	<div id="{$content->id}" class="wp-caption {$content->align}" style="width: {$content->width}px">{$html}</span><p class="wp-caption-text"> {$content->caption} <div style="float: right; width: 50%;"><p class="wp-caption-text"></br>$credit</p></div><div style="float: left; width: 50%;"><p style="font-size:12px"></br> tags: $mediaTags</style></p></div></div>
       END;
       	return $result;
       }
       ```
   
 * Do you know what I need to do to make your tags show up?
 * [http://wordpress.org/extend/plugins/media-tags/](http://wordpress.org/extend/plugins/media-tags/)

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

 *  Thread Starter [bitsybride](https://wordpress.org/support/users/bitsybride/)
 * (@bitsybride)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adding-tags-to-caption/#post-3182361)
 * Here is another failed attempt:
 *     ```
       add_filter( 'img_caption_shortcode', 'wp_image_credit_img_caption_shortcode', 10, 3 );
       function wp_image_credit_img_caption_shortcode($attr, $content, $html){
       	global $post;
       	$content = (object)$content;
       	$credit = wp_image_credit_get_credit_link(substr($content->id, strpos($content->id, "_") + 1));
       	$mt_terms = the_mediatags($id = 0);
   
       	$result = <<<END
       	<div id="{$content->id}" class="wp-caption {$content->align}" style="width: {$content->width}px">{$html}</span><p class="wp-caption-text"> {$content->caption} <div style="float: right; width: 50%;"><p class="wp-caption-text"></br>$credit</p></div><div style="float: left; width: 50%;"><p style="font-size:12px"></br> tags: coming soon! $mt_terms </style></p></div></div>
       END;
       	return $result;
       }
       ```
   
 *  Plugin Author [Paul Menard](https://wordpress.org/support/users/pmenard/)
 * (@pmenard)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adding-tags-to-caption/#post-3182387)
 * bitsybride, Let me know if you still need help on this.
 *  [cramerhwood](https://wordpress.org/support/users/cramerhwood/)
 * (@cramerhwood)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/adding-tags-to-caption/#post-3182434)
 * bitsybride, Did you ever figure it out? I’m trying something similar. I can’t
   get the_mediatags to return anything.

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

The topic ‘adding tags to caption’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/media-tags.svg)
 * [Media Tags](https://wordpress.org/plugins/media-tags/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-tags/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-tags/)
 * [Active Topics](https://wordpress.org/support/plugin/media-tags/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-tags/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-tags/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [cramerhwood](https://wordpress.org/support/users/cramerhwood/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/adding-tags-to-caption/#post-3182434)
 * Status: not resolved