Remove tab if no content
-
I’m using the following code to rename my product tabs including the “Additional Information” tab which contains variable attributes.
//Rename Product Tabs function rename_products_tab($tabs) { //Renames The default 'Description' tab $tabs['description']['title'] = 'Features'; // Rename the additional information tab $tabs['additional_information']['title'] = __( 'Details' ); return $tabs; } add_filter( 'woocommerce_product_tabs', 'rename_products_tab');But if a product doesn’t have any additional information then I get the following error message.
call_user_func() expects parameter 1 to be a valid callback, no array or string given in …/wp-content/plugins/woocommerce/templates/single-product/tabs/tabs.php on line 35
Everything works fine if I don’t rename the “additional information” tab and remove this:
// Rename the additional information tab $tabs['additional_information']['title'] = __( 'Details'But I’m trying to find a way to keep the renaming code and fix the problem. Is there an if statement that could remove the tab if no content exists?
The topic ‘Remove tab if no content’ is closed to new replies.