I’m trying to create a function where I rename the image while it is uploading. I want to name the image file as the post id. The code below works when uploading images to posts in WP Admin, however, when I try to recreate this on edit-product page it is not returning the ID, it gives NULL.
Not sure about the default flow but in my case the the product is created and saved as draft once vendors are on edit-product page. I can see this as the products can be found in products -> drafts. There I can see in the URL that they do have a post ID assigned to them. Therefore I thought that it should be possible to grab the post id on the edit-product page.
If not, how should I use the hook? Add to the existing function or create a seperate function?
@Tim Kerremans, as you can understand the flow is not supported by default and we presume you have done some custom code to achieve this.
So I would request you to contact the developer who has created this custom flow for you, as they know the coding you have applied and can assist you further on this. i.e. how to use hook and what code to apply.