diff --git a/admin/woocommerce-admin-install.php b/admin/woocommerce-admin-install.php
index 47dc5ae68a7..ff35af62bf0 100644
--- a/admin/woocommerce-admin-install.php
+++ b/admin/woocommerce-admin-install.php
@@ -27,7 +27,7 @@ function do_install_woocommerce() {
woocommerce_init_roles();
// Register post types
- $woocommerce->init_taxonomy();
+ include_once( '../classes/class-wc-post-types.php' );
// Add default taxonomies
woocommerce_default_taxonomies();
diff --git a/classes/class-wc-post-types.php b/classes/class-wc-post-types.php
new file mode 100644
index 00000000000..9120733706c
--- /dev/null
+++ b/classes/class-wc-post-types.php
@@ -0,0 +1,360 @@
+permalinks = get_option( 'woocommerce_permalinks' );
+
+ add_action( 'init', array( $this, 'register_taxonomies' ) );
+ add_action( 'init', array( $this, 'register_post_types' ) );
+ }
+
+ /**
+ * Register WooCommerce taxonomies.
+ *
+ * @access public
+ * @return void
+ */
+ public function register_taxonomies() {
+
+ if ( post_type_exists( 'product' ) )
+ return;
+
+ do_action( 'woocommerce_register_taxonomy' );
+
+ register_taxonomy( 'product_type',
+ apply_filters( 'woocommerce_taxonomy_objects_product_type', array( 'product' ) ),
+ apply_filters( 'woocommerce_taxonomy_args_product_type', array(
+ 'hierarchical' => false,
+ 'show_ui' => false,
+ 'show_in_nav_menus' => false,
+ 'query_var' => is_admin(),
+ 'rewrite' => false
+ ) )
+ );
+
+ register_taxonomy( 'product_cat',
+ apply_filters( 'woocommerce_taxonomy_objects_product_cat', array( 'product' ) ),
+ apply_filters( 'woocommerce_taxonomy_args_product_cat', array(
+ 'hierarchical' => true,
+ 'update_count_callback' => '_woocommerce_term_recount',
+ 'label' => __( 'Product Categories', 'woocommerce' ),
+ 'labels' => array(
+ 'name' => __( 'Product Categories', 'woocommerce' ),
+ 'singular_name' => __( 'Product Category', 'woocommerce' ),
+ 'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
+ 'search_items' => __( 'Search Product Categories', 'woocommerce' ),
+ 'all_items' => __( 'All Product Categories', 'woocommerce' ),
+ 'parent_item' => __( 'Parent Product Category', 'woocommerce' ),
+ 'parent_item_colon' => __( 'Parent Product Category:', 'woocommerce' ),
+ 'edit_item' => __( 'Edit Product Category', 'woocommerce' ),
+ 'update_item' => __( 'Update Product Category', 'woocommerce' ),
+ 'add_new_item' => __( 'Add New Product Category', 'woocommerce' ),
+ 'new_item_name' => __( 'New Product Category Name', 'woocommerce' )
+ ),
+ 'show_ui' => true,
+ 'query_var' => true,
+ 'capabilities' => array(
+ 'manage_terms' => 'manage_product_terms',
+ 'edit_terms' => 'edit_product_terms',
+ 'delete_terms' => 'delete_product_terms',
+ 'assign_terms' => 'assign_product_terms',
+ ),
+ 'rewrite' => array(
+ 'slug' => empty( $this->permalinks['category_base'] ) ? _x( 'product-category', 'slug', 'woocommerce' ) : $this->permalinks['category_base'],
+ 'with_front' => false,
+ 'hierarchical' => true,
+ ),
+ ) )
+ );
+
+ register_taxonomy( 'product_tag',
+ apply_filters( 'woocommerce_taxonomy_objects_product_tag', array( 'product' ) ),
+ apply_filters( 'woocommerce_taxonomy_args_product_tag', array(
+ 'hierarchical' => false,
+ 'update_count_callback' => '_woocommerce_term_recount',
+ 'label' => __( 'Product Tags', 'woocommerce' ),
+ 'labels' => array(
+ 'name' => __( 'Product Tags', 'woocommerce' ),
+ 'singular_name' => __( 'Product Tag', 'woocommerce' ),
+ 'menu_name' => _x( 'Tags', 'Admin menu name', 'woocommerce' ),
+ 'search_items' => __( 'Search Product Tags', 'woocommerce' ),
+ 'all_items' => __( 'All Product Tags', 'woocommerce' ),
+ 'parent_item' => __( 'Parent Product Tag', 'woocommerce' ),
+ 'parent_item_colon' => __( 'Parent Product Tag:', 'woocommerce' ),
+ 'edit_item' => __( 'Edit Product Tag', 'woocommerce' ),
+ 'update_item' => __( 'Update Product Tag', 'woocommerce' ),
+ 'add_new_item' => __( 'Add New Product Tag', 'woocommerce' ),
+ 'new_item_name' => __( 'New Product Tag Name', 'woocommerce' )
+ ),
+ 'show_ui' => true,
+ 'query_var' => true,
+ 'capabilities' => array(
+ 'manage_terms' => 'manage_product_terms',
+ 'edit_terms' => 'edit_product_terms',
+ 'delete_terms' => 'delete_product_terms',
+ 'assign_terms' => 'assign_product_terms',
+ ),
+ 'rewrite' => array(
+ 'slug' => empty( $this->permalinks['tag_base'] ) ? _x( 'product-tag', 'slug', 'woocommerce' ) : $this->permalinks['tag_base'],
+ 'with_front' => false
+ ),
+ ) )
+ );
+
+ register_taxonomy( 'product_shipping_class',
+ apply_filters( 'woocommerce_taxonomy_objects_product_shipping_class', array('product', 'product_variation') ),
+ apply_filters( 'woocommerce_taxonomy_args_product_shipping_class', array(
+ 'hierarchical' => true,
+ 'update_count_callback' => '_update_post_term_count',
+ 'label' => __( 'Shipping Classes', 'woocommerce' ),
+ 'labels' => array(
+ 'name' => __( 'Shipping Classes', 'woocommerce' ),
+ 'singular_name' => __( 'Shipping Class', 'woocommerce' ),
+ 'menu_name' => _x( 'Shipping Classes', 'Admin menu name', 'woocommerce' ),
+ 'search_items' => __( 'Search Shipping Classes', 'woocommerce' ),
+ 'all_items' => __( 'All Shipping Classes', 'woocommerce' ),
+ 'parent_item' => __( 'Parent Shipping Class', 'woocommerce' ),
+ 'parent_item_colon' => __( 'Parent Shipping Class:', 'woocommerce' ),
+ 'edit_item' => __( 'Edit Shipping Class', 'woocommerce' ),
+ 'update_item' => __( 'Update Shipping Class', 'woocommerce' ),
+ 'add_new_item' => __( 'Add New Shipping Class', 'woocommerce' ),
+ 'new_item_name' => __( 'New Shipping Class Name', 'woocommerce' )
+ ),
+ 'show_ui' => true,
+ 'show_in_nav_menus' => false,
+ 'query_var' => is_admin(),
+ 'capabilities' => array(
+ 'manage_terms' => 'manage_product_terms',
+ 'edit_terms' => 'edit_product_terms',
+ 'delete_terms' => 'delete_product_terms',
+ 'assign_terms' => 'assign_product_terms',
+ ),
+ 'rewrite' => false,
+ ) )
+ );
+
+ register_taxonomy( 'shop_order_status',
+ apply_filters( 'woocommerce_taxonomy_objects_shop_order_status', array('shop_order') ),
+ apply_filters( 'woocommerce_taxonomy_args_shop_order_status', array(
+ 'hierarchical' => false,
+ 'update_count_callback' => '_update_post_term_count',
+ 'show_ui' => false,
+ 'show_in_nav_menus' => false,
+ 'query_var' => is_admin(),
+ 'rewrite' => false,
+ ) )
+ );
+
+ global $wc_attributes, $woocommerce;
+
+ $wc_attributes = array();
+
+ if ( $attribute_taxonomies = $woocommerce->get_attribute_taxonomies() ) {
+ foreach ( $attribute_taxonomies as $tax ) {
+ if ( $name = $woocommerce->attribute_taxonomy_name( $tax->attribute_name ) ) {
+
+ $label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name;
+
+ $wc_attributes[ $name ] = $tax;
+
+ register_taxonomy( $name,
+ apply_filters( 'woocommerce_taxonomy_objects_' . $name, array( 'product' ) ),
+ apply_filters( 'woocommerce_taxonomy_args_' . $name, array(
+ 'hierarchical' => true,
+ 'update_count_callback' => '_update_post_term_count',
+ 'labels' => array(
+ 'name' => $label,
+ 'singular_name' => $label,
+ 'search_items' => sprintf( __( 'Search %s', 'woocommerce' ), $label ),
+ 'all_items' => sprintf( __( 'All %s', 'woocommerce' ), $label ),
+ 'parent_item' => sprintf( __( 'Parent %s', 'woocommerce' ), $label ),
+ 'parent_item_colon' => sprintf( __( 'Parent %s:', 'woocommerce' ), $label ),
+ 'edit_item' => sprintf( __( 'Edit %s', 'woocommerce' ), $label ),
+ 'update_item' => sprintf( __( 'Update %s', 'woocommerce' ), $label ),
+ 'add_new_item' => sprintf( __( 'Add New %s', 'woocommerce' ), $label ),
+ 'new_item_name' => sprintf( __( 'New %s', 'woocommerce' ), $label )
+ ),
+ 'show_ui' => false,
+ 'query_var' => true,
+ 'capabilities' => array(
+ 'manage_terms' => 'manage_product_terms',
+ 'edit_terms' => 'edit_product_terms',
+ 'delete_terms' => 'delete_product_terms',
+ 'assign_terms' => 'assign_product_terms',
+ ),
+ 'show_in_nav_menus' => apply_filters( 'woocommerce_attribute_show_in_nav_menus', false, $name ),
+ 'rewrite' => array(
+ 'slug' => ( empty( $this->permalinks['attribute_base'] ) ? '' : trailingslashit( $this->permalinks['attribute_base'] ) ) . sanitize_title( $tax->attribute_name ),
+ 'with_front' => false,
+ 'hierarchical' => true
+ ),
+ ) )
+ );
+ }
+ }
+ }
+ }
+
+ /**
+ * Register core post types
+ */
+ public function register_post_types() {
+
+ if ( post_type_exists('product') )
+ return;
+
+ /**
+ * Post Types
+ **/
+ do_action( 'woocommerce_register_post_type' );
+
+ $product_permalink = empty( $this->permalinks['product_base'] ) ? _x( 'product', 'slug', 'woocommerce' ) : $this->permalinks['product_base'];
+
+ register_post_type( "product",
+ apply_filters( 'woocommerce_register_post_type_product',
+ array(
+ 'labels' => array(
+ 'name' => __( 'Products', 'woocommerce' ),
+ 'singular_name' => __( 'Product', 'woocommerce' ),
+ 'menu_name' => _x( 'Products', 'Admin menu name', 'woocommerce' ),
+ 'add_new' => __( 'Add Product', 'woocommerce' ),
+ 'add_new_item' => __( 'Add New Product', 'woocommerce' ),
+ 'edit' => __( 'Edit', 'woocommerce' ),
+ 'edit_item' => __( 'Edit Product', 'woocommerce' ),
+ 'new_item' => __( 'New Product', 'woocommerce' ),
+ 'view' => __( 'View Product', 'woocommerce' ),
+ 'view_item' => __( 'View Product', 'woocommerce' ),
+ 'search_items' => __( 'Search Products', 'woocommerce' ),
+ 'not_found' => __( 'No Products found', 'woocommerce' ),
+ 'not_found_in_trash' => __( 'No Products found in trash', 'woocommerce' ),
+ 'parent' => __( 'Parent Product', 'woocommerce' )
+ ),
+ 'description' => __( 'This is where you can add new products to your store.', 'woocommerce' ),
+ 'public' => true,
+ 'show_ui' => true,
+ 'capability_type' => 'product',
+ 'map_meta_cap' => true,
+ 'publicly_queryable' => true,
+ 'exclude_from_search' => false,
+ 'hierarchical' => false, // Hierarchical causes memory issues - WP loads all records!
+ 'rewrite' => $product_permalink ? array( 'slug' => untrailingslashit( $product_permalink ), 'with_front' => false, 'feeds' => true ) : false,
+ 'query_var' => true,
+ 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes' ),
+ 'has_archive' => ( $shop_page_id = woocommerce_get_page_id( 'shop' ) ) && get_page( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop',
+ 'show_in_nav_menus' => true
+ )
+ )
+ );
+
+ register_post_type( "product_variation",
+ apply_filters( 'woocommerce_register_post_type_product_variation',
+ array(
+ 'label' => __( 'Variations', 'woocommerce' ),
+ 'public' => false,
+ 'hierarchical' => false,
+ 'supports' => false
+ )
+ )
+ );
+
+ $menu_name = _x('Orders', 'Admin menu name', 'woocommerce' );
+
+ if ( $order_count = woocommerce_processing_order_count() ) {
+ $menu_name .= " " . number_format_i18n( $order_count ) . "" ;
+ }
+
+ register_post_type( "shop_order",
+ apply_filters( 'woocommerce_register_post_type_shop_order',
+ array(
+ 'labels' => array(
+ 'name' => __( 'Orders', 'woocommerce' ),
+ 'singular_name' => __( 'Order', 'woocommerce' ),
+ 'add_new' => __( 'Add Order', 'woocommerce' ),
+ 'add_new_item' => __( 'Add New Order', 'woocommerce' ),
+ 'edit' => __( 'Edit', 'woocommerce' ),
+ 'edit_item' => __( 'Edit Order', 'woocommerce' ),
+ 'new_item' => __( 'New Order', 'woocommerce' ),
+ 'view' => __( 'View Order', 'woocommerce' ),
+ 'view_item' => __( 'View Order', 'woocommerce' ),
+ 'search_items' => __( 'Search Orders', 'woocommerce' ),
+ 'not_found' => __( 'No Orders found', 'woocommerce' ),
+ 'not_found_in_trash' => __( 'No Orders found in trash', 'woocommerce' ),
+ 'parent' => __( 'Parent Orders', 'woocommerce' ),
+ 'menu_name' => $menu_name
+ ),
+ 'description' => __( 'This is where store orders are stored.', 'woocommerce' ),
+ 'public' => false,
+ 'show_ui' => true,
+ 'capability_type' => 'shop_order',
+ 'map_meta_cap' => true,
+ 'publicly_queryable' => false,
+ 'exclude_from_search' => true,
+ 'show_in_menu' => current_user_can( 'manage_woocommerce' ) ? 'woocommerce' : true,
+ 'hierarchical' => false,
+ 'show_in_nav_menus' => false,
+ 'rewrite' => false,
+ 'query_var' => false,
+ 'supports' => array( 'title', 'comments', 'custom-fields' ),
+ 'has_archive' => false,
+ )
+ )
+ );
+
+ register_post_type( "shop_coupon",
+ apply_filters( 'woocommerce_register_post_type_shop_coupon',
+ array(
+ 'labels' => array(
+ 'name' => __( 'Coupons', 'woocommerce' ),
+ 'singular_name' => __( 'Coupon', 'woocommerce' ),
+ 'menu_name' => _x( 'Coupons', 'Admin menu name', 'woocommerce' ),
+ 'add_new' => __( 'Add Coupon', 'woocommerce' ),
+ 'add_new_item' => __( 'Add New Coupon', 'woocommerce' ),
+ 'edit' => __( 'Edit', 'woocommerce' ),
+ 'edit_item' => __( 'Edit Coupon', 'woocommerce' ),
+ 'new_item' => __( 'New Coupon', 'woocommerce' ),
+ 'view' => __( 'View Coupons', 'woocommerce' ),
+ 'view_item' => __( 'View Coupon', 'woocommerce' ),
+ 'search_items' => __( 'Search Coupons', 'woocommerce' ),
+ 'not_found' => __( 'No Coupons found', 'woocommerce' ),
+ 'not_found_in_trash' => __( 'No Coupons found in trash', 'woocommerce' ),
+ 'parent' => __( 'Parent Coupon', 'woocommerce' )
+ ),
+ 'description' => __( 'This is where you can add new coupons that customers can use in your store.', 'woocommerce' ),
+ 'public' => false,
+ 'show_ui' => true,
+ 'capability_type' => 'shop_coupon',
+ 'map_meta_cap' => true,
+ 'publicly_queryable' => false,
+ 'exclude_from_search' => true,
+ 'show_in_menu' => current_user_can( 'manage_woocommerce' ) ? 'woocommerce' : true,
+ 'hierarchical' => false,
+ 'rewrite' => false,
+ 'query_var' => false,
+ 'supports' => array( 'title' ),
+ 'show_in_nav_menus' => false
+ )
+ )
+ );
+ }
+}
+
+new WC_Post_types();
\ No newline at end of file
diff --git a/woocommerce.php b/woocommerce.php
index fe2f9a4922f..4da6b3a8273 100644
--- a/woocommerce.php
+++ b/woocommerce.php
@@ -300,6 +300,9 @@ class Woocommerce {
if ( ! is_admin() || defined('DOING_AJAX') )
$this->frontend_includes();
+ // Post types
+ include_once( 'classes/class-wc-post-types.php' ); // Registers post types
+
// Functions
include_once( 'woocommerce-core-functions.php' ); // Contains core functions for the front/back end
@@ -511,9 +514,6 @@ class Woocommerce {
// Register globals for WC environment
$this->register_globals();
- // Init WooCommerce taxonomies
- $this->init_taxonomy();
-
// Init Images sizes
$this->init_image_sizes();
@@ -746,346 +746,6 @@ class Woocommerce {
}
- /**
- * Init WooCommerce taxonomies.
- *
- * @access public
- * @return void
- */
- public function init_taxonomy() {
-
- if ( post_type_exists('product') )
- return;
-
- /**
- * Slugs
- **/
- $permalinks = get_option( 'woocommerce_permalinks' );
- $shop_page_id = woocommerce_get_page_id( 'shop' );
-
- // Base slug is also used for the product post type archive
- $base_slug = $shop_page_id > 0 && get_page( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop';
-
- // Get bases
- $product_category_slug = empty( $permalinks['category_base'] ) ? _x( 'product-category', 'slug', 'woocommerce' ) : $permalinks['category_base'];
- $product_tag_slug = empty( $permalinks['tag_base'] ) ? _x( 'product-tag', 'slug', 'woocommerce' ) : $permalinks['tag_base'];
- $product_attribute_base = empty( $permalinks['attribute_base'] ) ? '' : trailingslashit( $permalinks['attribute_base'] );
- $product_permalink = empty( $permalinks['product_base'] ) ? _x( 'product', 'slug', 'woocommerce' ) : $permalinks['product_base'];
-
- if ( $product_permalink )
- $rewrite = array( 'slug' => untrailingslashit( $product_permalink ), 'with_front' => false, 'feeds' => true );
- else
- $rewrite = false;
-
- $show_in_menu = current_user_can( 'manage_woocommerce' ) ? 'woocommerce' : true;
-
- /**
- * Taxonomies
- **/
- do_action( 'woocommerce_register_taxonomy' );
-
- $admin_only_query_var = is_admin();
-
- register_taxonomy( 'product_type',
- apply_filters( 'woocommerce_taxonomy_objects_product_type', array('product') ),
- apply_filters( 'woocommerce_taxonomy_args_product_type', array(
- 'hierarchical' => false,
- 'update_count_callback' => '_update_post_term_count',
- 'show_ui' => false,
- 'show_in_nav_menus' => false,
- 'query_var' => $admin_only_query_var,
- 'rewrite' => false
- ) )
- );
- register_taxonomy( 'product_cat',
- apply_filters( 'woocommerce_taxonomy_objects_product_cat', array('product') ),
- apply_filters( 'woocommerce_taxonomy_args_product_cat', array(
- 'hierarchical' => true,
- 'update_count_callback' => '_woocommerce_term_recount',
- 'label' => __( 'Product Categories', 'woocommerce'),
- 'labels' => array(
- 'name' => __( 'Product Categories', 'woocommerce'),
- 'singular_name' => __( 'Product Category', 'woocommerce'),
- 'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
- 'search_items' => __( 'Search Product Categories', 'woocommerce'),
- 'all_items' => __( 'All Product Categories', 'woocommerce'),
- 'parent_item' => __( 'Parent Product Category', 'woocommerce'),
- 'parent_item_colon' => __( 'Parent Product Category:', 'woocommerce'),
- 'edit_item' => __( 'Edit Product Category', 'woocommerce'),
- 'update_item' => __( 'Update Product Category', 'woocommerce'),
- 'add_new_item' => __( 'Add New Product Category', 'woocommerce'),
- 'new_item_name' => __( 'New Product Category Name', 'woocommerce')
- ),
- 'show_ui' => true,
- 'query_var' => true,
- 'capabilities' => array(
- 'manage_terms' => 'manage_product_terms',
- 'edit_terms' => 'edit_product_terms',
- 'delete_terms' => 'delete_product_terms',
- 'assign_terms' => 'assign_product_terms',
- ),
- 'rewrite' => array(
- 'slug' => $product_category_slug,
- 'with_front' => false,
- 'hierarchical' => true,
- //'ep_mask' => EP_CATEGORIES
- ),
- ) )
- );
-
- register_taxonomy( 'product_tag',
- apply_filters( 'woocommerce_taxonomy_objects_product_tag', array('product') ),
- apply_filters( 'woocommerce_taxonomy_args_product_tag', array(
- 'hierarchical' => false,
- 'update_count_callback' => '_woocommerce_term_recount',
- 'label' => __( 'Product Tags', 'woocommerce'),
- 'labels' => array(
- 'name' => __( 'Product Tags', 'woocommerce'),
- 'singular_name' => __( 'Product Tag', 'woocommerce'),
- 'menu_name' => _x( 'Tags', 'Admin menu name', 'woocommerce' ),
- 'search_items' => __( 'Search Product Tags', 'woocommerce'),
- 'all_items' => __( 'All Product Tags', 'woocommerce'),
- 'parent_item' => __( 'Parent Product Tag', 'woocommerce'),
- 'parent_item_colon' => __( 'Parent Product Tag:', 'woocommerce'),
- 'edit_item' => __( 'Edit Product Tag', 'woocommerce'),
- 'update_item' => __( 'Update Product Tag', 'woocommerce'),
- 'add_new_item' => __( 'Add New Product Tag', 'woocommerce'),
- 'new_item_name' => __( 'New Product Tag Name', 'woocommerce')
- ),
- 'show_ui' => true,
- 'query_var' => true,
- 'capabilities' => array(
- 'manage_terms' => 'manage_product_terms',
- 'edit_terms' => 'edit_product_terms',
- 'delete_terms' => 'delete_product_terms',
- 'assign_terms' => 'assign_product_terms',
- ),
- 'rewrite' => array( 'slug' => $product_tag_slug, 'with_front' => false ),
- ) )
- );
-
- register_taxonomy( 'product_shipping_class',
- apply_filters( 'woocommerce_taxonomy_objects_product_shipping_class', array('product', 'product_variation') ),
- apply_filters( 'woocommerce_taxonomy_args_product_shipping_class', array(
- 'hierarchical' => true,
- 'update_count_callback' => '_update_post_term_count',
- 'label' => __( 'Shipping Classes', 'woocommerce'),
- 'labels' => array(
- 'name' => __( 'Shipping Classes', 'woocommerce'),
- 'singular_name' => __( 'Shipping Class', 'woocommerce'),
- 'menu_name' => _x( 'Shipping Classes', 'Admin menu name', 'woocommerce' ),
- 'search_items' => __( 'Search Shipping Classes', 'woocommerce'),
- 'all_items' => __( 'All Shipping Classes', 'woocommerce'),
- 'parent_item' => __( 'Parent Shipping Class', 'woocommerce'),
- 'parent_item_colon' => __( 'Parent Shipping Class:', 'woocommerce'),
- 'edit_item' => __( 'Edit Shipping Class', 'woocommerce'),
- 'update_item' => __( 'Update Shipping Class', 'woocommerce'),
- 'add_new_item' => __( 'Add New Shipping Class', 'woocommerce'),
- 'new_item_name' => __( 'New Shipping Class Name', 'woocommerce')
- ),
- 'show_ui' => true,
- 'show_in_nav_menus' => false,
- 'query_var' => $admin_only_query_var,
- 'capabilities' => array(
- 'manage_terms' => 'manage_product_terms',
- 'edit_terms' => 'edit_product_terms',
- 'delete_terms' => 'delete_product_terms',
- 'assign_terms' => 'assign_product_terms',
- ),
- 'rewrite' => false,
- ) )
- );
-
- register_taxonomy( 'shop_order_status',
- apply_filters( 'woocommerce_taxonomy_objects_shop_order_status', array('shop_order') ),
- apply_filters( 'woocommerce_taxonomy_args_shop_order_status', array(
- 'hierarchical' => false,
- 'update_count_callback' => '_update_post_term_count',
- 'show_ui' => false,
- 'show_in_nav_menus' => false,
- 'query_var' => $admin_only_query_var,
- 'rewrite' => false,
- ) )
- );
-
- $attribute_taxonomies = $this->get_attribute_taxonomies();
- if ( $attribute_taxonomies ) {
- foreach ($attribute_taxonomies as $tax) {
-
- $name = $this->attribute_taxonomy_name( $tax->attribute_name );
- $hierarchical = true;
- if ($name) {
-
- $label = ( isset( $tax->attribute_label ) && $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name;
-
- $show_in_nav_menus = apply_filters( 'woocommerce_attribute_show_in_nav_menus', false, $name );
-
- register_taxonomy( $name,
- apply_filters( 'woocommerce_taxonomy_objects_' . $name, array('product') ),
- apply_filters( 'woocommerce_taxonomy_args_' . $name, array(
- 'hierarchical' => $hierarchical,
- 'update_count_callback' => '_update_post_term_count',
- 'labels' => array(
- 'name' => $label,
- 'singular_name' => $label,
- 'search_items' => __( 'Search', 'woocommerce') . ' ' . $label,
- 'all_items' => __( 'All', 'woocommerce') . ' ' . $label,
- 'parent_item' => __( 'Parent', 'woocommerce') . ' ' . $label,
- 'parent_item_colon' => __( 'Parent', 'woocommerce') . ' ' . $label . ':',
- 'edit_item' => __( 'Edit', 'woocommerce') . ' ' . $label,
- 'update_item' => __( 'Update', 'woocommerce') . ' ' . $label,
- 'add_new_item' => __( 'Add New', 'woocommerce') . ' ' . $label,
- 'new_item_name' => __( 'New', 'woocommerce') . ' ' . $label
- ),
- 'show_ui' => false,
- 'query_var' => true,
- 'capabilities' => array(
- 'manage_terms' => 'manage_product_terms',
- 'edit_terms' => 'edit_product_terms',
- 'delete_terms' => 'delete_product_terms',
- 'assign_terms' => 'assign_product_terms',
- ),
- 'show_in_nav_menus' => $show_in_nav_menus,
- 'rewrite' => array( 'slug' => $product_attribute_base . sanitize_title( $tax->attribute_name ), 'with_front' => false, 'hierarchical' => $hierarchical ),
- ) )
- );
-
- }
- }
- }
-
- /**
- * Post Types
- **/
- do_action( 'woocommerce_register_post_type' );
-
- register_post_type( "product",
- apply_filters( 'woocommerce_register_post_type_product',
- array(
- 'labels' => array(
- 'name' => __( 'Products', 'woocommerce' ),
- 'singular_name' => __( 'Product', 'woocommerce' ),
- 'menu_name' => _x( 'Products', 'Admin menu name', 'woocommerce' ),
- 'add_new' => __( 'Add Product', 'woocommerce' ),
- 'add_new_item' => __( 'Add New Product', 'woocommerce' ),
- 'edit' => __( 'Edit', 'woocommerce' ),
- 'edit_item' => __( 'Edit Product', 'woocommerce' ),
- 'new_item' => __( 'New Product', 'woocommerce' ),
- 'view' => __( 'View Product', 'woocommerce' ),
- 'view_item' => __( 'View Product', 'woocommerce' ),
- 'search_items' => __( 'Search Products', 'woocommerce' ),
- 'not_found' => __( 'No Products found', 'woocommerce' ),
- 'not_found_in_trash' => __( 'No Products found in trash', 'woocommerce' ),
- 'parent' => __( 'Parent Product', 'woocommerce' )
- ),
- 'description' => __( 'This is where you can add new products to your store.', 'woocommerce' ),
- 'public' => true,
- 'show_ui' => true,
- 'capability_type' => 'product',
- 'map_meta_cap' => true,
- 'publicly_queryable' => true,
- 'exclude_from_search' => false,
- 'hierarchical' => false, // Hierarchical causes memory issues - WP loads all records!
- 'rewrite' => $rewrite,
- 'query_var' => true,
- 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes' ),
- 'has_archive' => $base_slug,
- 'show_in_nav_menus' => true
- )
- )
- );
-
- register_post_type( "product_variation",
- apply_filters( 'woocommerce_register_post_type_product_variation',
- array(
- 'label' => __( 'Variations', 'woocommerce' ),
- 'public' => false,
- 'hierarchical' => false,
- 'supports' => false
- )
- )
- );
-
- $menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
- if ( $order_count = woocommerce_processing_order_count() ) {
- $menu_name .= " " . number_format_i18n( $order_count ) . "" ;
- }
-
- register_post_type( "shop_order",
- apply_filters( 'woocommerce_register_post_type_shop_order',
- array(
- 'labels' => array(
- 'name' => __( 'Orders', 'woocommerce' ),
- 'singular_name' => __( 'Order', 'woocommerce' ),
- 'add_new' => __( 'Add Order', 'woocommerce' ),
- 'add_new_item' => __( 'Add New Order', 'woocommerce' ),
- 'edit' => __( 'Edit', 'woocommerce' ),
- 'edit_item' => __( 'Edit Order', 'woocommerce' ),
- 'new_item' => __( 'New Order', 'woocommerce' ),
- 'view' => __( 'View Order', 'woocommerce' ),
- 'view_item' => __( 'View Order', 'woocommerce' ),
- 'search_items' => __( 'Search Orders', 'woocommerce' ),
- 'not_found' => __( 'No Orders found', 'woocommerce' ),
- 'not_found_in_trash' => __( 'No Orders found in trash', 'woocommerce' ),
- 'parent' => __( 'Parent Orders', 'woocommerce' ),
- 'menu_name' => $menu_name
- ),
- 'description' => __( 'This is where store orders are stored.', 'woocommerce' ),
- 'public' => false,
- 'show_ui' => true,
- 'capability_type' => 'shop_order',
- 'map_meta_cap' => true,
- 'publicly_queryable' => false,
- 'exclude_from_search' => true,
- 'show_in_menu' => $show_in_menu,
- 'hierarchical' => false,
- 'show_in_nav_menus' => false,
- 'rewrite' => false,
- 'query_var' => false,
- 'supports' => array( 'title', 'comments', 'custom-fields' ),
- 'has_archive' => false,
- )
- )
- );
-
- register_post_type( "shop_coupon",
- apply_filters( 'woocommerce_register_post_type_shop_coupon',
- array(
- 'labels' => array(
- 'name' => __( 'Coupons', 'woocommerce' ),
- 'singular_name' => __( 'Coupon', 'woocommerce' ),
- 'menu_name' => _x( 'Coupons', 'Admin menu name', 'woocommerce' ),
- 'add_new' => __( 'Add Coupon', 'woocommerce' ),
- 'add_new_item' => __( 'Add New Coupon', 'woocommerce' ),
- 'edit' => __( 'Edit', 'woocommerce' ),
- 'edit_item' => __( 'Edit Coupon', 'woocommerce' ),
- 'new_item' => __( 'New Coupon', 'woocommerce' ),
- 'view' => __( 'View Coupons', 'woocommerce' ),
- 'view_item' => __( 'View Coupon', 'woocommerce' ),
- 'search_items' => __( 'Search Coupons', 'woocommerce' ),
- 'not_found' => __( 'No Coupons found', 'woocommerce' ),
- 'not_found_in_trash' => __( 'No Coupons found in trash', 'woocommerce' ),
- 'parent' => __( 'Parent Coupon', 'woocommerce' )
- ),
- 'description' => __( 'This is where you can add new coupons that customers can use in your store.', 'woocommerce' ),
- 'public' => false,
- 'show_ui' => true,
- 'capability_type' => 'shop_coupon',
- 'map_meta_cap' => true,
- 'publicly_queryable' => false,
- 'exclude_from_search' => true,
- 'show_in_menu' => $show_in_menu,
- 'hierarchical' => false,
- 'rewrite' => false,
- 'query_var' => false,
- 'supports' => array( 'title' ),
- 'show_in_nav_menus' => false
- )
- )
- );
- }
-
-
/**
* Init images.
*