I have a wordpress multisite with one main and four child website. i have done plugin for share woocommerce product to childsite. now child site can add or update mainsite product from child site. but when displaying in front end the media path is wrong. i want use all child site product image path to same path. how it possible ?
Leave a Reply
You must be logged in to post a comment.
In woocommerce plugin and in file class-wc-admin-post-types.php
woocomerce override the WordPress upload filter through the filter ‘upload_dir’
so if you want to override it, you can create filter to this ‘upload_dir’ with higher priorites.
I would call this a try and error thing, I had done something similar but it takes some time customizing as your desired.
So here it’s what I believe could solve your main problem:
if the
$blog_id
is not the main site (reads ID = 1) you should switch to blog ID 1, all this is happening before all post are pulled from the database.product is the current post_type being queried, if you want this to work with orders as well you probably will check for
'shop_order'
.To know which post_type is being queried you should check the url, Ex:
/edit.php?post_type=shop_order
.This probably would bring some issues such as the title of the blog in the adminbar is the one from the main site, and it’s missing that at some point it needs to restore to the main site back, but at least this should do the trick.
check this Solution and Let me know how end up