0

I have over 600 products on my website and adding image title to every individual image is going to consume hours if not days, so i would like to know the way to apply the product title to image title automatically for all images.

  • Hi I don't find the Woo Image SEO plugin relevant because there is no "intelligence" in the tool. On our side, we add an AI layer with ImageSEO if you are ever interested: wordpress.org/plugins/imageseo – Thomas Deneulin Oct 11 at 11:47
0

Try this:

add_filter('wp_get_attachment_image_attributes', 
'change_attachement_image_attributes', 20, 2);

function change_attachement_image_attributes( $attr, $attachment ){
// Get post parent
$parent = get_post_field( 'post_parent', $attachment);

// Get post type to check if it's product
$type = get_post_field( 'post_type', $parent);
if( $type != 'product' ){
    return $attr;
}

/// Get title
$title = get_post_field( 'post_title', $parent);

$attr['alt'] = $title;
$attr['title'] = $title;

return $attr;
}     

taken from: How to automatically apply woocommerce product title to all product images alt tags?

  • It doesn't seem to work – Mike Jun 13 '18 at 2:23
0

You can use this plugin: https://wordpress.org/plugins/woo-image-seo/

By default, the plugin will do just the thing you want - it will use the product's title (or name) and apply it to all its images.
You can also customize the image titles by using the "attribute builder".
For example, if you wish to include the product's category before the product name, you can do it like this:
enter image description here

You can do the same for your image's alt attributes as well.

0

You don't have to add image title to over 600 products one by one manually. You just need to use Auto Image Attributes From Filename With Bulk Updater plugin. It allows you to add image attributes, including image title, from the image filename, automatically. So, it can save you a lot of time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.