• Resolved maipiusenza

    (@maipiusenza)


    Hi, I have category names like:
    SS23
    – Woman SS23
    – T-shirt woman SS23

    In admin they must have this name (not only the slug), but in front end I would like to simplify it into

    SS23
    – Woman
    – T-shirt

    So Y could use a preg_replace() in a code snippet to change the names as needed.
    But what action should I call to get the categories, replace the names and return them?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    I hope you’re doing well :D.

    Please, try to add the following code in the functions.php of your active theme

    add_filter( 'yith_wcan_tax_filter_item_args', 'yith_wcan_customize_filter_item_args',10,2 );
    
    if( ! function_exists( 'yith_wcan_customize_filter_item_args' ) ){
        function yith_wcan_customize_filter_item_args( $term_options, $term_id ){
    
            $term_options['label'] = str_replace("SS23", "", $term_options['label']);
            
            return $term_options;
        }
    }

    Please, try it and let me know.

    Have a good day.

    Thread Starter maipiusenza

    (@maipiusenza)

    Perfect!
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Replace Category names’ is closed to new replies.