是否可以在 Wordpress 管理面板上从 WooCommerce 更改产品菜单链接的文本?

mit*_*dir 2 wordpress woocommerce

我们可以更改表示 Products 的父项,然后将该名称更改为其他名称,但不能更改子项。

是否可以?

在此处输入图片说明

非常感谢

LTa*_*sty 6

有两种方法可以做到这一点。首先是通过提供的 PO/MO 文件进行翻译。

另一种方式您可以更改过滤器上的标签。

add_filter( 'woocommerce_register_post_type_product', 'custom_post_type_label_woo' );

function custom_post_type_label_woo( $args ){
    $labels = array(
        'name'               => __( 'Elements', 'your-custom-plugin' ),
        'singular_name'      => __( 'Element', 'your-custom-plugin' ),
        'menu_name'          => _x( 'Elements', 'Admin menu name', 'your-custom-plugin' ),
        'add_new'            => __( 'Add Element', 'your-custom-plugin' ),
        'add_new_item'       => __( 'Add New Tour', 'your-custom-plugin' ),
        'edit'               => __( 'Edit Element', 'your-custom-plugin' ),
        'edit_item'          => __( 'Edit Element', 'your-custom-plugin' ),
        'new_item'           => __( 'New Element', 'your-custom-plugin' ),
        'view'               => __( 'View Element', 'your-custom-plugin' ),
        'view_item'          => __( 'View Element', 'your-custom-plugin' ),
        'search_items'       => __( 'Search Elements', 'your-custom-plugin' ),
        'not_found'          => __( 'No Elements found', 'your-custom-plugin' ),
        'not_found_in_trash' => __( 'No Elements found in trash', 'your-custom-plugin' ),
        'parent'             => __( 'Parent Element', 'your-custom-plugin' )
    );

    $args['labels'] = $labels;
    $args['description'] = __( 'This is where you can add new tours to your store.', 'your-custom-plugin' );
    return $args;
}
Run Code Online (Sandbox Code Playgroud)