WordPress.org

Ready to get started?Download WordPress

Forums

Set up default image title and captions? (3 posts)

  1. Richmond Media
    Member
    Posted 1 year ago #

    Does anyone know how to set a default caption that will appear on all uploaded images? I am building a site for a car lot client that has to be ridiculously easy for him to use. I would like the caption to automatically read "Click to enlarge" on any images he uploads to the site, if possible.

    It sounds dumb at first glance, but he will be uploading images of cars on his lot, and they will all be captioned "Click to enlarge"...

    Thanks in advance!

  2. bcworkz
    Member
    Posted 1 year ago #

    My first thought would be to pre-populate the field in media uploader. This would likely require a javascript function added to the uploader. Not sure how to do this, especially in a way that avoids a dirty hack. Something that may be worth investigating though.

    Using PHP, you probably need to add it to the post content as it is inserted into the DB. Hook something like the 'wp_insert_post_data' filter. Your code would search the content for image tags in the post that are not embedded by caption shortcode. You would extract the needed info for the shortcode from the image tag, then insert the appropriate shortcode tags along with the needed caption.

  3. keith13
    Member
    Posted 1 year ago #

    SEO Friendly Images plugin will do it for you. I use it and it works very well.

    Sorry, I'm wrong. SEO Friendly Images doesn't do bulk captions, only Titles and the ALT attributes

Topic Closed

This topic has been closed to new replies.

About this Topic