title: Woocommerce: code for adding custom alt and title tag to product images works, but brakes product admin page
body: <p>setting up a Woocommerce shop, I wanted to add custom alt and title tags to product images, based on product title, tags and one attribute. I added code to child functions.php, and it seemed to work - both on front and in Media manager I got the alt and title tags I wanted, everything seemed ok.</p>
  
  <p>Until I tried to edit a product page on the admin area....it loads only halfway (the whole section below the main content box is missing), shows no product tags added, and by the product image it says : </p>
  
  <p><strong>Fatal error: Call to a member function get_tags() on null in functions.php on line 112</strong></p>
  
  <p>My code in the child functions.php ($authortags beeing line 112):</p>
  
  <pre><code>// Change images alt and title tag 
  add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes', 20, 2);
  function change_attachement_image_attributes($attr, $attachment) {
  global $post, $product;
  if ($post-&gt;post_type == 'product') {
      $title = $post-&gt;post_title;
      $authortags = strip_tags ($product-&gt;get_tags());
      $editor = $product-&gt;get_attribute( 'pa_szerkesztette' );
  
      $attr['alt'] = $title .' '. $authortags .' '. $editor;
      $attr['title'] = $title .' '. $authortags .' '. $editor;
  }
  return $attr;
  }   
  </code></pre>
  
  <p>It's the same with all product pages. I guess the problem is stripping the tags, and I should find another method to get them in the code, but nothing I've tried did work (my php knowledge is rather limited...) .</p>
  
  <p>Could anyone help me, what am I doing wrong, how to modify the code to get this work?
  Thanks</p>