Support » Plugins and Hacks » Use Caption Field instead of Title and Size?

Use Caption Field instead of Title and Size?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor techotronic



    the title attribute of the image tag is used for the Colorbox.
    Your theme implements which text is put into that attribute.

    When you upload images, there are three fields that you can put text into, most probably your theme takes the contents of one of these fields.

    My plugin can’t use the caption since every theme works differently and there is no generic way to determine where the text is rendered.


    Ah, that makes sense now. It’s probably my SEO plugin that’s causing the funky titles then. I’ll see if I can do something to change those settings.

    Sorry to hijack your thread, but I just had the same problem. I resolved it adding a filter into my functions.php file.

    if (!is_admin() && $GLOBALS["pagenow"] != "wp-login.php") {
    add_filter('wp_get_attachment_image_attributes', 'filter_image_title', 10, 2);
    function filter_image_title($attr, $attachment = null){
    	$attr['title'] = $attachment->post_excerpt;
    	return $attr;

    techotronic – I’ve seen quite a lot of people asking for this, couldnt you add a setting in your plugin that does the same thing and gives users the choice of what to display? I did have a little look at your source code but it would take a lot of trial and error for me to understand the way it all ties together.

    thanks for the plugin though! 🙂

    Plugin Contributor techotronic


    Hi @kriszani

    Thanks for the code snippet.

    wp_get_attachment_image_attributes seems only to be used on image attachment pages in the themes that I looked at (if at all), so it’s probably not something that I’d put into the plugin.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use Caption Field instead of Title and Size?’ is closed to new replies.