这可能是更好的方法,但是我终于设法做到了:
function map( $erstat ) {
global $find;
$find = array("Dame>Mode>Blazere & veste>Elegante blazere","Dame>Sport & Outdoor>Overtøj>Skibukser","Default Category > Accessories > Cufflinks & tie bars");
$replace = array( "Mænd > Accessories > Solbriller","Mænd > Tøj > Trøjer > Hættetrøjer","Mænd > Tøj > Trøjer > Hættetrøjer");
return $replace[array_search($erstat,$find)];
}
function my_is_post_to_create( $continue_import,$data,$import_id ) {
map( $erstat );
global $find;
$awin = $data['merchant_product_category_path'];
if (in_array( $awin,$find )) return true;
}
add_filter('wp_all_import_is_post_to_create','my_is_post_to_create',10,3);
在较早的尝试中,我没有给函数提供任何可比较的东西,所以我做了两个新函数。第一个是我将类别映射到网站上正确的类别路径的位置。另一个功能是在这里我告诉应该导入到网站的内容,在这里我告诉它仅当来自merchant_product_category_path
的{{1}}在csv/xml
数组中时才导入。
本文链接:https://www.f2er.com/2993711.html