renaming product description title with custom sentence including product name

73 Views Asked by At

i've been trying to write

WHY 'MY PRODUCT TITLE'

In the product description tab, i've successfully renamed it with

'MY PRODUCT TITLE'

but i can't type the remaining word

WHY

in the description title tab.

the code i used is given below:

 add_filter( 'woocommerce_product_tabs', 
            'wc_change_product_description_tab_title', 10, 1 );
           function wc_change_product_description_tab_title( $tabs ) {
              global $post;
                if ( isset( $tabs['description']['title'] ) )
                $tabs['description']['title'] =  $post->post_title;
              return $tabs; 
}  

this code prints the product title and when i try this code so that i can type

why

any help is greatly appreciated

1

There are 1 best solutions below

0
On BEST ANSWER
add_filter( 'woocommerce_product_tabs',
'wc_change_product_description_tab_title', 10, 1 );
function wc_change_product_description_tab_title( $tabs ) {
  global $post;
  if ( isset( $tabs['description']['title'] ) )
  $tabs['description']['title'] =  'WHY'.' '.$post->post_title;
  return $tabs;
}