Media Credit

Feel free to get in touch with us about anything you’d like me to add to this plugin or any feedback. We love hearing from our users! Start a thread on the plugin forum and we’ll get back to you shortly!

This plugin adds a “Credit” field when uploading media to posts and displays it under the images on your blog to properly credit the artist.

When adding media through the Media Uploader tool or editing media already in the Media Library, this plugin adds a new field to the media form that allows users to assign credit for given media to a user of your blog (assisted with autocomplete) or to any freeform text (e.g. courtesy photos, etc.).

When this media is then inserted into a post, a new shortcode, [media-credit], surrounds the media, inside of any caption, with the provided media credit information. Media credit inside this shortcode is then displayed on your blog under your media with the class .media-credit, which has some default styling but which you can customize to your heart’s content.

You can also display all the media by an author on the author’s page. See more in the FAQ.

This plugin provides a few options which appear on the Media page under Settings. These options are:

  • Separator
  • Organization
  • Display credits after post


This is best explained with an example. With a separator of ” | ” and an organization of The Daily Times, media inserted will be followed with a credit line appearing as follows, with the username linking to the author page for that user:

John Smith | The Daily Times

Further explanation

Separator: These are the characters that separate the display name for a user on your blog from the name of the organization, as described below. The default separator is ” | ” but feel free to change this to suit your needs.

Organization: This is what appears after the separator as listed above. The default organization is the name of your blog.

Display credits after post: With this option enabled, media credit shortcodes will not appear by default when inserting media into your posts. Instead, the plugin will look through the content of your posts for any media attachments and display something like the following at the end of each post with the CSS class .media-credit-end:

Images courtesy of John Smith | The Daily Times, Michael Scott and Jane Doe.

In this example, John Smith is a user of your blog, while the latter two credits are not.

Download — Join 31378 already using this plugin

Latest version: Download Media Credit v3.1.7 [zip]

View on the WordPress plugin directory here: Media Credit


This section describes how to install the plugin and get it working.

The easiest way to install this plugin is to go to Add New in the Plugins section of your blog admin and search for “Media Credit.” On the far right side of the search results, click “Install.”

If the automatic process above fails, follow these simple steps to do a manual install:

  1. Extract the contents of the zip file into your /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Party.


Q. I disabled the plugin and now unparsed [media-credit] shortcodes are appearing all over my site. Help!
A. Add this to your theme’s functions.php file to get rid of those pesky [media-credit] shortcodes:

function ignore_media_credit_shortcode( $atts, $content = null ) {
    return $content;
global $shortcode_tags;
if ( !array_key_exists( 'media-credit', $shortcode_tags ) )
    add_shortcode('media-credit', 'ignore_media_credit_shortcode' );

Also, I’d really appreciate it if you gave us some feedback as to why you disabled the plugin and how it could have better suited your needs.

Q. Can I display all or recent media credited to a given author?
A. Indeed, just call the template tag <?php display_author_media($author_id); ?> in your theme’s author.php (or elsewhere, if you want). The template tag has optional parameters if you want to customize the CSS or text. The default options will display thumbnails of the 10 most recent media items credited to the given user floated to the right with a width of 150px and a header of <h3>Recent Media</h3>.
These options can be changed with a more verbose call to the function: <?php display_author_media($author_id, $sidebar = true, $limit = 10, $link_without_parent = false, $header = "<h3>Recent Media</h3>", $exclude_unattached = true); ?>. This will make only the 10 most recent media items that are attached to a post display with the given header taking up the maximum width it’s afforded. Each image will link to the post in which it appears, or the attachment page if it has no parent post (unless $link_without_parent is set to false). If you don’t care about whether the media is attached to a post, change $exclude_unattached to `false√. This function as a whole will only display media uploaded and credited to a user after this plugin was installed.

Q. More generally, can I insert media credit information into my themes with a template tag, for instance on category pages?
A. I’m so glad you asked; you certainly can! Just call <?php get_media_credit_html($post); ?> with an attachment id (int) or WP_Post object for an attachment to get the media credit, including a link to the author page. To echo the results, call <?php the_media_credit_html($post); ?>.

Q. Is there a template tag that just gives plain text rather than a link to the author page for users of my blog?
A. Yep! If you would prefer plain-text rather than a link for all media credit (and leaving out the separator and organization), call <?php get_media_credit($post); ?> which uses the same parameter as above. To echo the results, call <?php the_media_credit($post); ?>.

Q. Can I link to an artist inside a media credit field?
A. You sure can. Just add the link attribute in the media-credit shortcode, found in HTML view for a post, or directly when adding an image. For example, if your post contains:

[media-credit name="Artist" align="alignleft" width="300"]<img src="" width="300" height="450" class="size-300 wp-image-2" />[/media-credit]

change it to:

[media-credit name="Artist" link="" align="alignleft" width="300"]<img src="" width="300" height="450" class="size-300 wp-image-2" />[/media-credit]

Note the link to above.

Q. Why do I get unparsed [media-credit] shortcodes in my Facebook/Twitter/… previews with JetPack Publicize?
A. Unfortunately, this is a known bug in JetPack that can only be fixed by Automattic. As a workaround, use a different plugin for posting to social networks. Alternatively, if you make sure that you haven’t got any images with credits within the first 55 words of your article, you should be fine, too.

Q. Your question was not answered in the FAQ?
A. Feel free to get in touch with us about anything you’d like us to add to this list by leaving a message in the support forums here.


3.1.7 (Feb. 24, 2017)

  • JavaScript components should be slightly more fault tolerant now.
  • The plugin does not depend on the visual editor being enabled anymore. Props karinamendonca29.

3.1.6 (Feb. 4, 2017)

  • Return '' (the empty string) when retrieving empty freeform credits.
  • Honor “Do not display default credit” for featured images.

3.1.5 (Jan. 29, 2017)

  • Prevent invalid link nesting in featured image credits. This means that by default, no <a> tags are printed for featured image credits.
    The old behaviour can be restored by including add_filter( 'media_credit_post_thumbnail_include_links', __return_true ); in the theme’s functions.php.
  • “Display credit after posts” is now restricted to the proper single post view (and not every usage of the_content hook).
  • “Display credit after posts” is honored when used together with “Display credit for featured images”.

3.1.4 (Jan. 1, 2017)

  • Properly sync models when editing image details.

3.1.3 (Dec. 21, 2016)

  • Removed non-existent customizer callback (props @rboulet).

3.1.2 (Dec. 11, 2016)

  • Fixed conflict between WPBakery Visual Composer 4.x and Media Credit.
  • Updated TinyMCE components.

3.1.1 (Aug. 15, 2016)

  • Fixed JavaScript error in media uploaded directly from Edit Post (wp_prepare_attachment_for_js only gets called after the upload finishes in 4.5.x).

3.1.0 (Aug. 13, 2016)

  • Optional no-follow attribute added.
  • Optional markup added.
  • Use HTML5 placeholders instead of default text when “no default credits” is set.
  • Settings have been updated & streamlined.
  • Added caching for backend queries.
  • Updated TinyMCE components.
  • Switched to the new Media API based on Backbone.js introduced in WordPress 3.5 for a snappier and more consistent user experience.
  • Several security fixes and a general code clean-up have been applied due to automatic enforcement of WordPress coding standards.
  • Fixed conflict between “no default credits” and featured image credits.

3.0.3 (Jul. 13, 2016)

  • Updating credits via the Visual Editor works again. Props siricar, timausk, jellylegs.
  • Consolidated UI in “Edit Image” dialog.

3.0.2 (Apr. 12, 2016)

  • Updated visual editor plugin for WordPress 4.5 (minimum WordPress version is now 4.5, as well).

3.0.1 (Mar. 20, 2016)

  • Fixed run_wptexturize filter breakage caused by calling get_bloginfo too early.

3.0.0 (Mar. 6, 2016)

  • Refactored plugin for a more future-proof architecture.
  • Moved all non-‘template tag’ functions out of the global namespace. This might break themes that relied on these (undocumented) functions. Please test before updating if you are running a highly customized installation of Media Credit.
  • Wrap standalone media credits in <figure> if HTML5 support for captions is enabled.
  • Uses WordPress language packs for translations.
  • Fixed previously broken use case when both caption and credit are removed from an image in the visual editor.
  • Added check whether parent is already published when displaying “attached” media.
  • Added support for featured image credits.

2.7.6 (Feb. 7, 2016)

  • Backported fix for removing both credit and caption in Visual Editor (from 3.0 development branch).
  • Please note: This will likely be the last patch before 3.0.

2.7.5 (Nov. 30, 2015)

  • Fixed a bug in Preview script.

2.7.4 (Oct. 19, 2015)

  • Fixed empty $credit array for media_credit_at_end filter when there is only one (unique) credit. Props David Higgins.

2.7.3 (Sep. 30, 2015)

  • Somewhere, the caption ID attribute got lost. Sorry.

2.7.2 (Sep. 25, 2015)

  • Fixed silent error message regarding unset no_default_credit option
  • Fixed wpautop handling. Probably.

2.7.1 (Sep. 16, 2015)

  • Missed a few strings
  • Fixed incorrect positional parameter strings

2.7 (Sep. 16, 2015)

  • Honor ‘Do not display default credit’ option in conjunction with ‘Display credit after posts’
  • Added translation functions to user visible strings
  • Added German translation
  • Fixed responsive image breakage on some themes
  • Fixed autocomplete in Customizer

2.6.2 (Aug. 29, 2015)

  • Updated JS for switching between Visual and HTML editors
  • Fixed freeform credit parsing in Visual editor

2.6.1 (Aug. 17, 2015)

  • Fixed “media credit at end”

2.6.0 (Aug. 12, 2015)

  • limit selectable users to authors (no subscribers)
  • URL can be set from Media Library, not just in the post editor
  • Credit URL can override the automatic author link
  • Added media_credit_at_end filter hook

2.5.1 (Aug. 2, 2015)

  • Forgot to remove some debug output

2.5.0 (Jun. 7, 2015)

  • Added URL parameter to shortcode and GUI
  • Display image toolbar with WP 4.2

2.4.1 (Dec. 20, 2014)

  • Fix missing newlines when switching between HTML and Visual mode in the post editor

2.4.0 (Dec. 17, 2014)

  • Replaced some deprecated calls
  • Fixed bug that didn’t add shortcode when editing a “plain” img tag.
  • Updated UI for WordPress 4.1

2.3.3 (Oct. 26, 2014)

  • Fixed encoding bug with HTML credit lines

2.3.2 (Oct. 22, 2014)

  • Fixed editing of image classes in the visual editor

2.3.1 (Oct. 9, 2014)

  • Fixed deletion of [media-credit] shortcodes without in the visual editor
  • Fixed bug that added to apostrophes/single quotes in certain circumstances

2.3.0 (Sep. 18, 2014)

  • Code clean-up
  • Added support for visual editing of shortcodes
  • Fixed edited posts not updating when credits are changed via the media modal.
  • Added FAQ regarding unparsed shortcodes with JetPack Publicize

2.2.3 (Sep. 10, 2014)

  • Add plugin version to CSS & JS files to ensure the autocomplete bugfix is applied.

2.2.2 (Sep. 6, 2014)

  • Fixed long-standing bug with saving autocompleted credits
  • Fixed missing autocomplete in WP 4.0 media grid

2.2.1 (Sep. 4, 2014)

  • Fixed E_NOTICE level error message

2.2.0 (Sep. 4, 2014)

  • Added option to prevent attachment authors as default credit
  • Updated TinyMCE plugin for WordPress 4.0
  • Various bugfixes

2.1.2 (Aug. 12, 2014)

  • Fixed a packaging error that rendered the plugin inoperational

2.1.1 (Aug. 11, 2014)

  • Fix Visual Editor mode when credit field is empty

2.1.0 (Apr. 16, 2014)

  • Compatibility with WordPress 3.9 (TinyMCE 4.x)
  • Completely new Visual Editor code

2.0.1 (Oct. 29, 2013)

  • Bumped version number to fix update notice for users of 1.1.2

2.0 (Oct. 27, 2013)

  • Compatibility with WordPress 3.5 media dialog
  • Fixes for bugs in Visual editor
  • Fixed shortcode parsing (broken since WordPress 3.4)

1.1.2 (Mar. 1, 2011)

  • Fixes total autocomplete failure on WordPress 3.1
  • Fixes freeform credit situation where a user was selected but freeform text was entered afterward
  • Fixes extra output on activation notices (they weren’t serious, but I imagine some people were freaking out seeing them)

1.1.1 (Sep. 19, 2010)

  • Updating media credit in the Media Library really does update the credit within posts correctly now! (props: Greg Wrey)
  • Adding multiple images with freeform media credit to a post also now works as expected (props: Greg Wrey)

1.1 (Jun. 25, 2010)

  • Now compatible with TinyMCE! Media credit will appear inline (i.e. below the photo) when using the Visual editor rather than as an ugly shortcode.
  • Updating media credit in the Media Library will now correctly and safely update it in an attached post, regardless of whether it’s a WP user or not

1.0.2 (May 3, 2010)

  • Added filter on the_author so that media credit is properly displayed in Media Library (not yet for unattached media, though – will be added in WP 3.1 hopefully)
  • Made $post parameter actually optional in template tags (used global $post if not given)

1.0.1 (Apr. 26, 2010)

  • Changed post meta field from media-credit to _media_credit so that it doesn’t appear in custom fields section on Post edit page normally. Upgrade script will handle changing the key for all existing metadata.

1.0 (Apr. 26, 2010)

  • Added author media rendering methods (see FAQ)
  • If media credit is edited in the Media Library, the media credit in the post to which media is attached to will now update as well!
  • Only load JS and CSS in admin on pages that need it
  • Blank credit can now be assigned to media
  • Switched rendering of media-credit shortcode credit info to div instead of span for more readable RSS feed

0.5.5 (Mar. 9, 2010)

  • Switched autocomplete to an older, more stable version – should be working great now for all blogs!
  • With above, fixed loss of control of AJAX functionality in WordPress admin area
  • Default options are now correctly registered when the plugin is activated
  • Any pre-existing options will not be overwritten when activating the plugin
  • Separator and organization names on the settings page are properly escaped

0.5.1 (Mar. 5, 2010)

  • Fixed autocomplete when selecting credit so that it only shows currently selectable users (particularly important for WordPress MU users).
  • Made it so that upon clicking in the Credit field the text already there will be highlighted – start typing right away!
  • Hid media credit inline with attachments if the “Display credits after post” option is enabled.

0.5 (Mar. 4, 2010)

  • Initial release.

28 thoughts on “Media Credit

  1. Luke

    Hi Scott,

    Can this plugin handle the situation where multiple images are contained in a post and a different credit is required for each one? How would I display the credit for each image rather than one credit at the bottom of the post? I would like to access credits per image programatically,


    1. Scott Bressler Post author

      Hi Luke,

      Media Credit absolutely can handle multiple images per post. See here for an example.

      What do you mean you would like to access the image credits programmatically? Do you mean that you want to display the credits yourself instead of letting the plugin display them for you? You can certainly do that as well! Take a look at the third FAQ for the plugin; you’re going to want to use < ?php the_media_credit_html($post); ?>.

      Let me know if you have any further questions or difficulty using the plugin!


  2. Luke

    Hi Scott – thanks for your reply. The difficulty we’re having seems to be that the credit is not saving to the database but reverting to the author name. Do you have any idea what might be causing that?

  3. Romeo B.

    I am having the same problem as Luke. Even when I fill in a new name for the credit field, it always reverts back to Admin, as that’s the username I’m signed in under. It seems that it’s not saving what’s written int the credit field. I’m using WP3.0.

  4. CArl


    It seems that there is now a problem with the media credit plug. When attempting to edit a post that I have used the plug tag with, the entire post is not showing up in the edit window when using VISUAL view, however; the post will show up under HTML view with codes.

    After disabling the plug, the posts reappear in VISUAL view.


  5. Francesco

    I think one thing is missing for this excellent plugin: the ability to add a custom field with a link for the custom credit. In other words, I would like to be able to add to pictures a custom credit name and a custom link, not only a custom credit name.

    Regards, Francesco.

    1. Scott Bressler Post author

      Thanks for this excellent bit of feedback! Coincidentally, I actually got the same request from someone else this week and added the answer to the FAQ for the plugin above.

      Here’s the relevant section:

      Can I link to an artist inside a media credit field?

      You sure can. Just link to the artist’s website in the name attribute in the media-credit shortcode, found in HTML view for a post, or directly when adding an image. For example, if your post contains:

      [media-credit name="Artist" align="alignleft" width="300"]<img src="" width="300" height="450" class="size-300 wp-image-2" />[/media-credit]

      change it to:

      [media-credit name="<a href=''>Artist</a>" align="alignleft" width="300"]<img src="" width="300" height="450" class="size-300 wp-image-2" />[/media-credit]

      Note the link to above.

      I’m considering making this easier so people who don’t know HTML can do this as well, and I will let you know if I begin working on another approach. However, for now, this should hopefully suffice. Always open to feedback!

  6. Brian Robertson

    Ok Scott, I love the concept of this plugin! What do you think about in the settings being able to set a custom “Media Credit Phrase” – just leave it blank if you don’t want to use it – and also a “Link Target”. And then with each image have the following options: “Photographer” and “Photographer’s Site” – or something like that. Then, beneath the image it adds (my php probably isn’t correct, but you’ll get the point):

    <?php echo (Media Credit Phrase) & " " & (Photographer) & "/>"; ?>

    Example: “Photo provided by Bald Brian

  7. eddie

    Hi Scott,

    Love the concept of your plugin. I can’t get it to work though. Like some of the above posters, the name I enter reverts to the post author’s name upon saving. I’m running 1.1.1.


    1. Scott Bressler Post author

      Hi Eddie,

      I’m sorry to hear about your troubles with the plugin. What version of WP are you using? Does the issue happen every time you try to give credit to users? Does it only happen for users of your blog, or only for “freeform” credits, or does it happen for any and all credit you try to attribute?


  8. Harry Underwood

    First off, I wanted to say that this plugin is extremely useful to my current job, as I did not have a proper means of attaching names to images as well as posts before this and Post Author Box. I am glad for both plugins’ existences.

    That said, I also wanted to ask if it is possible to further integrate Media Credit into the TinyMCE image capabilities in WordPress. When one wants to edit an image in a post (say, for size and external linking), Media Credit is conspicuously missing from among the options of editing the attributes of images (but not from when one wants to upload an image or go into the gallery of already uploaded images). Also, I wonder if NextGEN Gallery’s makers could benefit from your contribution.

    Once again, I love this plugin, and wish I had come across it sooner! Thank you!

  9. Gregg

    I have the same issue mentioned above running Media Credit v1.1.2 and WP v3.1.2. I insert the template tag for plain text into single.php. However, the credit below the image reverts to the post author and not the plain text I have in the credit field in my media library.

    Interestingly, the author field in the media library listing reflects the value of the credit field correctly so I suspect that the value of $post refers to the post as opposed to the attachment. I don’t know enough PHP to figure it out, but I would love to get this working correctly.

    Any thoughts?

  10. Andy M

    Trying to attach the credit to individual photos. Done so in the upload photo section however it is not showing up under the image in an article, but is at the bottom of the article. We use many articles and would rather have the credit immediately below the image – how can i do this?

  11. Tery

    This plugin does exactly what I need, as far as adding the credit to the image and making it easy to style. However, I’m having a problem with the styling of my pre-existing caption. As far as I can tell, media-credit puts the caption in a definition list. I need to style that definition list to remove the top margin, but I can’t find where to do that. You can see an example of the problem at .

    I need to change:
    <dl id="attachment_2469" class="wp-caption alignright" style="width: 310px;">
    <dl id="attachment_2469" class="wp-caption alignright" style="width: 310px; margin-top:0px;">
    but I can’t find where to do that. Help?

    1. Scott Bressler Post author

      Hi Tery,

      You’ll want to do this in your theme’s CSS file rather than modifying the plugin directly. You should be able to target the images, captions, and media credit sections using the CSS classes you see above, among other tags. Just so you know, the code you posted is part of the caption, not the Media Credit, and the styling for it is coming from line 174 in custom.css in your newsport theme. Media Credit uses divs and spans only.

      Also, in your custom.css file, you specify a bunch of MC-specific styles. However, the targeting is incorrect for many of theme: .wp-caption-dt should be .wp-caption dt and so on.

      When modifying the caption styles, you might want to consider only modifying them if they immediately follow an MC div using adjacent sibling selectors, such as .media-credit-container + .wp-caption.

      1. Tery

        Thanks, Scott. The reason I thought the definition list code was coming from media-credit is that I have two images on that page — one with media-credit and one without. The one with media credit looks like this:
        <div class="mceTemp"><div class="media-credit-container alignright" style="width: 310px"><a href="; rel="attachment wp-att-2469"><img class="size-medium wp-image-2469" title="Rb Brandon Wright breaks the tackle of 34 Joeseph Ross." src="×200.jpg&quot; alt="" width="300" height="200" /></a><span class="media-credit">The Whetstone/ Cochise Lucas</span></div><dl id="attachment_2469" class="wp-caption alignright" style="width: 310px;"><dt class="wp-caption-dt"></dt><dd class="wp-caption-dd">Rb Brandon Wright breaks the tackle of 34 Joeseph Ross.</dd></dl></div>

        while the one without media-credit looks like this:
        <div id="attachment_2463" class="wp-caption alignleft" style="width: 210px"><a href="; rel="attachment wp-att-2463"><img class="size-medium wp-image-2463" title="IMG_4756" src="×300.jpg&quot; alt="" width="200" height="300" /></a><p class="wp-caption-text">The Whetstone/ Cochise Lucas</p></div>

        I’ll try changing the values for the alignright class, but I’m afraid that will affect too many other places on the site. If that doesn’t work, is the solution then to find the caption processing in WordPress and add a third class, after alignright, to override that top margin?

      2. Tery

        I tried changing the top margin in alignright to 0px. That’s not fixing the problem. Also, the reason I specified .wp-caption-dt is that that’s the class associated with the dt. I thought the class would override the standard dt declaration, though I could be wrong about that. My CSS abilities are okay but not stellar.

      3. Scott Bressler Post author

        There are issues with using the “Visual” editor in WordPress 3.2 and up, so that’s likely why you have the “mceTemp” div. Try using the HTML editor.

        I’d recommend you put the navy background on something that surrounds both the media credit and the caption to ensure that there are no gray bars in between. If you can’t find anything to target with your CSS, you can surround the images yourself by filtering the_content in your functions.php file, though beware of any performance degradation.

  12. Tery

    Hi — Is this still supported? If so, I’m having a weird problem. When the media-credit plugin is active, I can’t insert images into posts. When I disable it, I can insert images again. I can’t disable it permanently because it seems to mess up the look of older posts, where we used the media-credit field, when it’s not active. So what we’re having to do is disable media-credit, insert the images into the post, then enable media-credit again. We’re running WordPress 3.5.1 with the Advanced Newspaper Theme from Gabfire.

  13. Art Campbell

    Really delighted to see the version 2 roll out!
    I’d been kludging the 1.x by hand for probably a year or more…
    However, the 2.0 version isn’t working on my site at all. Can’t insert media into a post if anything is in the Credit field….

    Anything I can check?

  14. Mar

    Your plugin works flawlessly. However, I am running into a situation where I’d like the thumbnails that your plugin places on my page via the template tag to be picked up by thickbox or slimbox as a gallery viewer. Is there a configuration or a php file that I can alter that will allow a thickbox plugin to pick up the thumbnails and display in a gallery rather than displaying each image on its own page?

  15. Jon

    Thanks for creating this plugin- it works great! Only one minor issue I was wondering about. After I have added an image, the edit and remove buttons on the image in the visual editor lose all their styling and are difficult to see on darker images. Below is the difference in code before and after Media Credit is activated:

    Without Media Credit activated:

    With Media Credit activated:

    The js changes the divs to ‘p’ and ‘i’ and then the styling disappears. I know this is a minor issue, but was wondering if it could be changed so the default styling doesn’t go away. I’ve tried to override the styling, but for some reason am having trouble getting it to apply to ‘#wp-image-toolbar i’.



Leave a Reply to CArl Cancel reply

Your email address will not be published. Required fields are marked *