I am assuming all of the tabs you want to rename are custom tabs. Here is a script that will update any tab named “Old Tab Title!” to “New Tab Title!”. Obviously you’ll have to change these names to match what your old and new titles are.
add_action( 'admin_init', 'manual_cpt_rename' );
// Manually rename tabs.
function manual_cpt_rename() {
if ( ! isset( $_GET['manual_cpt_rename'] ) ) {
return;
}
// Fetch all products.
$products = new WP_Query(
array(
'post_status' => 'any',
'post_type' => 'product',
'fields' => 'ids',
'posts_per_page' => '-1',
)
);
if ( $products->have_posts() ) {
foreach ( $products->posts as $product ) {
$tabs = get_post_meta( $product, 'yikes_woo_products_tabs', true );
if ( ! empty( $tabs ) ) {
foreach ( $tabs as $key => &$tab ) {
if ( $tab['title'] === 'Old Tab Title!' ) {
$tab['title'] = 'New Tab Title!';
}
}
update_post_meta( $product, 'yikes_woo_products_tabs', $tabs );
}
}
}
}
Add this snippet to functions.php
and then go to your WordPress admin and change the URL to {yoursite.com}/wp-admin/?manual_cpt_rename
in order to fire off the snippet. (i.e. add the ?manual_cpt_rename
to your admin URL).
Hope that makes sense.
Cheers,
Kevin.