title: WooCommerce product admin : get product images attachements in edition page not working?
body: <p>I am desperately trying to get back the attached images of a product in the Woocommerce publishing interface but it does not work.</p>
  <p>My script works when I am in the editing of a post but not in the &quot;editing of a product&quot; part of Woocommerce.</p>
  <p>I think it’s related to the fact that a product is a particular post, but I don’t see what to change to make it work.</p>
  <p>I went through the creation of a plugin in order not to touch the file &quot;functions.php&quot; of my Divi theme.</p>
  <p>My code :</p>
  <pre><code>global $pagenow;
  </code></pre>
  <p>if (( $pagenow == 'post.php' ) || (get_post_type() == 'post')) {</p>
  <pre><code>$postId = $_GET['post'];
  
  $post = array();
  
  $post = get_post( $postId );
  
  $args = array(
      'post_parent'    =&gt; $post-&gt;ID,
      'post_status' =&gt; 'inherit',
      'post_type'      =&gt; 'attachment',
      'post_mime_type' =&gt; 'image',
      'posts_per_page' =&gt; -1,
      'orderby'        =&gt; 'menu_order',
      'order'          =&gt; 'ASC',
  );
  
  $args = apply_filters( 'get_attached_media_args', $args, $type, $post );
  $children = get_children( $args );
  $images = array();
  $images = apply_filters( 'get_attached_media', $children, $type, $post );
  </code></pre>
  <p>var_dump($images);
  exit;</p>
  <p>Thanks a lot !</p>