init() public static method

Hook in methods.
public static init ( )
Ejemplo n.º 1
0
            $data['post_title'] = $order_title;
        } elseif ('product' === $data['post_type'] && isset($_POST['product-type'])) {
            $product_type = stripslashes($_POST['product-type']);
            switch ($product_type) {
                case 'grouped':
                case 'variable':
                    $data['post_parent'] = 0;
                    break;
            }
        }
        return $data;
    }
    /**
     * Some functions, like the term recount, require the visibility to be set prior. Lets save that here.
     *
     * @param int $post_id
     */
    public static function pre_post_update($post_id)
    {
        if (isset($_POST['_visibility'])) {
            if (update_post_meta($post_id, '_visibility', wc_clean($_POST['_visibility']))) {
                do_action('woocommerce_product_set_visibility', $post_id, wc_clean($_POST['_visibility']));
            }
        }
        if (isset($_POST['_stock_status'])) {
            wc_update_product_stock_status($post_id, wc_clean($_POST['_stock_status']));
        }
    }
}
WC_Post_Data::init();