WC_Brands::init_taxonomy()
Initializes brand taxonomy.
Метод класса: WC_Brands{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$result = WC_Brands::init_taxonomy();
Код WC_Brands::init_taxonomy() WC Brands::init taxonomy WC 9.4.2
public static function init_taxonomy() { $shop_page_id = wc_get_page_id( 'shop' ); $base_slug = $shop_page_id > 0 && get_page( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop'; $category_base = get_option( 'woocommerce_prepend_shop_page_to_urls' ) === 'yes' ? trailingslashit( $base_slug ) : ''; $slug = $category_base . __( 'brand', 'woocommerce' ); if ( '' === $category_base ) { $slug = get_option( 'woocommerce_brand_permalink', '' ); } // Can't provide transatable string as get_option default. if ( '' === $slug ) { $slug = __( 'brand', 'woocommerce' ); } register_taxonomy( 'product_brand', array( 'product' ), /** * Filter the brand taxonomy. * * @since 9.4.0 * * @param array $args Args. */ apply_filters( 'register_taxonomy_product_brand', array( 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __( 'Brands', 'woocommerce' ), 'labels' => array( 'name' => __( 'Brands', 'woocommerce' ), 'singular_name' => __( 'Brand', 'woocommerce' ), 'search_items' => __( 'Search Brands', 'woocommerce' ), 'all_items' => __( 'All Brands', 'woocommerce' ), 'parent_item' => __( 'Parent Brand', 'woocommerce' ), 'parent_item_colon' => __( 'Parent Brand:', 'woocommerce' ), 'edit_item' => __( 'Edit Brand', 'woocommerce' ), 'update_item' => __( 'Update Brand', 'woocommerce' ), 'add_new_item' => __( 'Add New Brand', 'woocommerce' ), 'new_item_name' => __( 'New Brand Name', 'woocommerce' ), 'not_found' => __( 'No Brands Found', 'woocommerce' ), 'back_to_items' => __( '← Go to Brands', 'woocommerce' ), ), 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_in_rest' => 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' => $slug, 'with_front' => false, 'hierarchical' => true, ), ) ) ); }