2016-06-21 76 views
-1

在WooCommerce中添加一些產品變體時,默認情況下會設置3個變體,並且無法添加新變體。WooCommerce:默認添加3個變體

這是我的代碼:

$my_post = array(
    'post_title' => 'Variation #' . $i . ' of 4 for prdct#'. $new_post_id, 
    'post_name' => 'product-' . $new_post_id . '-variation-' . $i, 
    'post_status' => 'publish', 
    'post_parent' => $new_post_id, 
    'post_type' => 'product_variation', 
    'guid'  => home_url() . '/?product_variation=product-' . $new_post_id . '-variation-' . $i 
); 
$attID = wp_insert_post($my_post); 

任何解決方案?

+1

你的問題不清楚,你的代碼不完整。你在哪裏使用它?什麼工作?什麼不是?哪裏定義了'$ new_post_id'?你是否使用了一些鉤子代碼?請編輯你的問題,並添加必要的細節以獲得幫助......如果你想讓這個問題得到人們的關注,你必須清楚而詳細。 – LoicTheAztec

回答

0

完成,這是使用插件YOAST Seo的問題。一旦我卸載了插件並安裝了另一個SEO插件,它就可以工作。