woocommerce_new_product_data
Usage
add_filter( 'woocommerce_new_product_data', 'wp_kama_woocommerce_new_product_data_filter' ); /** * Function for `woocommerce_new_product_data` filter-hook. * * @param $array * * @return */ function wp_kama_woocommerce_new_product_data_filter( $array ){ // filter... return $array; }
- $array
- -
Where the hook is called
woocommerce_new_product_data
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 172-190
apply_filters( 'woocommerce_new_product_data', array( 'post_type' => 'product', 'post_status' => $product->get_status() ? $product->get_status() : 'publish', 'post_author' => get_current_user_id(), 'post_title' => $product->get_name() ? $product->get_name() : __( 'Product', 'woocommerce' ), 'post_content' => $product->get_description(), 'post_excerpt' => $product->get_short_description(), 'post_parent' => $product->get_parent_id(), 'comment_status' => $product->get_reviews_allowed() ? 'open' : 'closed', 'ping_status' => 'closed', 'menu_order' => $product->get_menu_order(), 'post_password' => $product->get_post_password( 'edit' ), 'post_date' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getOffsetTimestamp() ), 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ), 'post_name' => $product->get_slug( 'edit' ), ) ),