This is not fancy, but it worked for me.
edit_yikes_tabs.php
<?php
/*INSTRUCTIONS
WARNING: This is built for a specific purpose and limited use. Do not leave this in your website in the current form.
NOTE: URL parameter &go=0 is for testing. &go=1 will execute the update so don't change that until you're ready.
1. Copy db settings from wp-config file and paste below
2. Define the TABLE_POSTMETA value below.
3. Upload to your website web directory
4. Test it at https://EXAMPLE.COM/edit_yikes_tabs.php?search=FIND&replace=REPLACE&go=0
5. DELETE the file from your website when done. This is quick primitive unsecure code.
*/
//DB CONNECT
define('DB_NAME','');
define('DB_USER','');
define('DB_PASSWORD','');
define('DB_HOST', 'localhost');
define('TABLE_POSTMETA','wp_postmeta');
$search = $_GET['search'];
$replace = $_GET['replace'];
$execute = $_GET['go'];
echo '<div>SEARCH: '.$search.'</div>';
echo '<div>REPLACE: '.$replace.'</div>';
// Create connection
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
mysqli_set_charset($mysqli,"utf8");
// Perform an SQL query
$sql = "SELECT <code>meta_id</code>,<code>meta_value</code> from ".TABLE_POSTMETA." where <code>meta_key</code> = 'yikes_woo_products_tabs'";
// to get the error information
if (!$result = $mysqli->query($sql)) {
echo "Error: Our query failed to execute and here is why: \n";
echo "Query: " . $sql . "\n";
echo "Errno: " . $mysqli->errno . "\n";
echo "Error: " . $mysqli->error . "\n";
exit;
}
if ($result->num_rows === 0) {
echo "No results";
exit;
}
while ($data = $result->fetch_assoc()) {
$value = unserialize($data['meta_value']);
echo '<div style="margin:10px; padding:10px; border:1px solid #00CC00; background:#FFFFCC">';
echo 'ORIGINAL SERIALIZED TAB DATA: <b>postmeta id: ' . $data['meta_id'] . '</b><br>' . $data['meta_value'];
echo '<hr><b>BEFORE</b><br>'; print_r($value);
for($i=0; $i < count($value); $i++){
$content = $value[$i]['content'];
if(strstr($content,$search) == true){
$value[$i]['content'] = str_replace($search,$replace,$content);
}
}
$new_value = serialize($value);
echo '<hr><b>AFTER</b><br>'; print_r($value);
echo '<hr><b>SERIALIZED</b><br>'.$new_value;
$update = "update wpso_postmeta set <code>meta_value</code> = '".$new_value."' where <code>meta_id</code>= '".$data['meta_id']."'";
if($execute == 1){
echo '<hr color="green" size="2"><b>UPDATE QUERY</b><br>'.$update;
$mysqli->query($update);
}
echo '</div>';
}
?>