Best practice for migration

I recently completed my first project with bricks builder. It’s a small artist page. johanna-kraeuter.at
I’ve built the site on my server and transfered the whole wp-installation to the client server after the site was ready for launch. I copied all files and the database (except uploads).
The wp install works, all contents are here BUT bricks builder shows only blank pages. In the pages list in wp backend the »Page name – Bricks« is also missing. The postmeta entry in the data base contains a lot of bricks data. Somehow the connection between bricks data and wp-pages got lost.

Can anyone tell me what I miss here?

Hi Benjamin,

Hard to say what went wrong. I have never had this kind of issue before, and I’m always building/developing locally. Have you replaced all local URLs with the live URL, and is Bricks active (and the license key enabled)?

Best regards,
timmse

Face the similar problem after manual migration, now using All in one plugin to migrate database and manually migrate the content files.

Thanks for your reply, timmse.

Yes, I made the bricks install active, when I tried making the site work. I don’t think that this was the problem because either way I should see Bricks-Pages marked with » – Bricks«, which I did not.

I used »Wordpress Backup & Migrate« for the transfer. Th9is toolnormally changes all urls to the new domain. After realizing that bricks didn’t work properly, I used »Better search and replace« which could not find any of my »old« urls in the database. As I don’t know how bricks saves contents in the database, I can’t rule out that there is an url problem.

My main question is, is there a best practice to transfer an existing bricks-installation from one Server to another? are there any urls saved in the postsmeta-table that could make the layouts disappear if not replaced correctly. Header and Footer template exist, but have also no content.

Best regards,
Benjamin

Hi masoodalam51, did it work?

Yes, with one hero image issue, if hero container background is image and external css enabled in bricks > settings > performance than that image loaded from previous url. You have to delete actual css from theme directory manually and regenerate css. Then it’s works fine.

2 Likes

These are my (manual) steps:

  1. Upload the whole installation to the server
  2. Export the database
  3. Create a new database on the server and import the previously exported database
  4. Edit the wp-config (new database credentials)
  5. Run this script to search and replace old > new URLs in the database: Database Search and Replace Script in PHP | inter.connect
  6. log in to wp-admin, check settings (WordPress Address, Site Address), save permalinks, check Bricks settings

That’s it. Sometimes it’s not possible to login directly due to some strange redirect issues - if it doesn’t work, I follow these steps: https://wordpress.org/support/article/changing-the-site-url/

I’ve never used a migration tool for this task :sweat_smile:

5 Likes

ok, that’s really nothing special. :innocent:
I’ll check out the url replacement script.

Thanks for your help,
Benjamin

1 Like

Let us know if it worked.

The Search & Replace Script is top. Thanks again.
Could not test my bricks-installation yet …

Hello @benjamin , did you ever figure out the cause? I am experiencing the same problem. Thanks.

Hi Nora,

it‘s been a while now and I cant quite remember how I fixed that. I think I moved the install to another hosting service (because I had to do this anyway) and ther it worked. Sorry, I can‘t really help you here. As soon as I find out about it, I‘ll post it here.

Hi @timmse ,
I’ve also used inter.connect’s S&R tool for every manual S&R tasks before, so I did it now too, on my first Bricks project, BUT, I have the same issue that @benjamin had in the first post here.

It looks like, changing the URLs in the content with this great PHP lib, WP forgot, that the pages were built with Bricks, so the “- Bricks” is missing from behind the page titles on the page list admin screen, and on the frontend, the content is missing altogether for each post, where I changed the URL in the content.

Could you please advise?

I had a similar problem with Bricks template URLs not updating after migrating, even though I had replaced all the old URLs in the database.

The solution was to go to Settings → General and press the Save Changes button. Also Settings → Permalinks and press the Save Changes. I don’t recall this being necessary when migrating a non-Bricks website.

1 Like

Hi there,

this might help anybody who still runs into this issue.
i have a working solution with this plugin (I’m not related to this in any way😊).
https://wordpress.org/plugins/better-search-replace/

Explanation:
The former issue came due to the fact that bricks uses serialized data in e.g. wp_postmeta table.
Let’s take a look at an example:

// part of db field data:
s:60:"https://dev.mydomain.de/wp-content/uploads/2025/07/image.jpg";

s:60 describes the string length. here: 60 chars long.

If you now run a script/plugin which searches for “https://dev.mydomain.de” and replaces it with e.g. “https://my-new-domain.de/”, the updated string becomes:

s:60:"https://www.my-new-domain.de/wp-content/uploads/2025/07/image.jpg";

…but this does not update the string length which now is 65.

The entry should be

s:65:"https://www.my-new-domain.de/wp-content/uploads/2025/07/image.jpg";

This is why some installations fail after replacing urls in the database items.

The plugin mentioned above replaces those values correctly so I recommend this as working solution.

Hello, thank you for the tip. I use this plugin, but sometimes it still happens that a template or a page does not appear, even though it has been created. However, this occurs only rarely and, for example, only with one page, not the entire site. Next time I will try re-saving the general settings and then the permalinks, as someone here mentioned. Does the plugin always work reliably for you? I even activate HTTPS on the site before running the plugin. I always manually change home to the new domain in the wp_options table, and then I use the plugin to update everything else. Another thought I had is whether the issue might be related to how the browser requires confirmation when copying an element—first you need to copy something, confirm it in the browser, and only then run the plugin to change the URLs?

For people that struggle with this I made this code that fixes seralization after migration and SQL name change to the new domain.

  1. You have to create a file in your root called fix-serialization.php
  2. Add this code in the file (please change your site name in the $needle to your site name)
<?php
require __DIR__ . '/wp-load.php';
if ( ! current_user_can('manage_options') ) { wp_die('Forbidden'); }

global $wpdb;
$needle = 'yoursitehere.com';

function fix_serialized_lengths($str) {
  return preg_replace_callback(
    '/s:(\d+):"(.*?)";/s',
    function($m) {
      $len = strlen($m[2]);
      return 's:' . $len . ':"' . $m[2] . '";';
    },
    $str
  );
}

function try_repair_value($raw) {
  $un = @unserialize($raw);
  if ($un !== false || $raw === 'b:0;') {
    return null;
  }
  $fixed = fix_serialized_lengths($raw);
  $un2 = @unserialize($fixed);
  if ($un2 !== false || $fixed === 'b:0;') {
    return serialize($un2);
  }
  return null;
}

$targets = [
  ['table' => $wpdb->options,   'id' => 'option_id', 'col' => 'option_value'],
  ['table' => $wpdb->postmeta,  'id' => 'meta_id',   'col' => 'meta_value'],
  ['table' => $wpdb->usermeta,  'id' => 'umeta_id',  'col' => 'meta_value'],
  ['table' => $wpdb->termmeta,  'id' => 'meta_id',   'col' => 'meta_value'],
  ['table' => $wpdb->commentmeta,'id'=> 'meta_id',   'col' => 'meta_value'],
];

$total_scanned = 0;
$total_fixed   = 0;

foreach ($targets as $t) {
  $table = $t['table'];
  $idcol = $t['id'];
  $valcol= $t['col'];
  $like = '%' . $wpdb->esc_like($needle) . '%';
  $ids = $wpdb->get_col(
    $wpdb->prepare(
      "SELECT {$idcol} FROM {$table} WHERE {$valcol} LIKE %s AND {$valcol} REGEXP '^[aObisCd]:'",
      $like
    )
  );
  if (!$ids) continue;
  foreach ($ids as $id) {
    $row = $wpdb->get_row(
      $wpdb->prepare("SELECT {$valcol} AS v FROM {$table} WHERE {$idcol} = %d", $id)
    );
    if (!isset($row->v)) continue;
    $total_scanned++;
    $newv = try_repair_value($row->v);
    if ($newv !== null && $newv !== $row->v) {
      $updated = $wpdb->update(
        $table,
        [$valcol => $newv],
        [$idcol => $id],
        ['%s'],
        ['%d']
      );
      if ($updated !== false) {
        $total_fixed++;
      }
    }
  }
}

echo "<pre>";
echo "Scanned rows: {$total_scanned}\n";
echo "Repaired rows: {$total_fixed}\n";
echo "Done\n";
echo "</pre>";

  1. Login in your site
  2. Run the script by visiting [yoursitename.com]/fix-serialization.php
  3. Done it should work. (The script returns the amount of fixes it makes.)

I don’t know why Briks doesn’t just add a button in settings that just does this but whatever.
Please be careful with the domain name and make sure it is the correct one in the php code but also in step 4.

1 Like