PHP Error when renaming product tab
-
Hi,
I’ve discoved an issue when renaming the product tabs.
I’m using the recommended code documented by Woocommerce to do this, and this issue is documented for the ‘The Additional Information tab’:
https://docs.woocommerce.com/document/editing-product-data-tabs/#section-6AH01071: Got error ‘PHP message: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /var/www/vhosts/domain.com/wp-content/themes/shopkeeper/woocommerce/single-product/tabs/tabs.php on line 73’
But using the recommended code:
// Rename product tabs
add_filter( ‘woocommerce_product_tabs’, ‘woo_rename_tabs’, 98 );
function woo_rename_tabs( $tabs ) {global $product;
if( $product->has_attributes() || $product->has_dimensions() || $product->has_weight() ) { // Check if product has attributes, dimensions or weight
$tabs[‘additional_information’][‘title’] = __( ‘Bike Specifications’ ); // Rename the additional information tab
$tabs[‘description’][‘title’] = __( ‘Professional Reviews’ ); // Rename the description tab
$tabs[‘reviews’][‘title’] = __( ‘User Reviews’ ); // Rename the reviews tab
}return $tabs;
}There is no error if I just change the ‘additional_information’tab, but get the error if we add in renaming for description and reviews tabs.
Any ideas on what I should try changing?
Thanks
Alex
- The topic ‘PHP Error when renaming product tab’ is closed to new replies.