slug is not sanitized when creating a product programatically
-
A WordPress site with only Woocommerce and my custom plugin, using a barebone theme with empty functions.php. WordPress and Woocommerce on latest versions.
I create a product like this:
$product_name = “PRODUCT NAME”;
$product = new \WC_Product_Simple();
$product->set_name( $product_name );
$product->set_sku( $product_sku );
… //etc
The slug (post_name) for the product is the same as post_title (PRODUCT NAME) and not product-name as it should.
What could be the possible reason for this?!? I am creating about 9000 products in a loop.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘slug is not sanitized when creating a product programatically’ is closed to new replies.