HTML migration error

Hi,
I’ve tried to migrate from shortcode to html after upgrading to the last version of PRO.

The migration stopped at 42/149. Everytime i try.

I get this error:

[18-Mar-2025 14:33:11 UTC] PHP Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in /home/customer/www/xxx/public_html/wp-content/themes/pro/cornerstone/includes/integration/html-storage.php:95

Stack trace:

#0 /home/customer/www/xxx/public_html/wp-content/themes/pro/cornerstone/includes/integration/html-storage.php(95): json_decode(Array, true)

#1 /home/customer/www/xxx/public_html/wp-content/themes/pro/cornerstone/includes/integration/html-storage.php(150): cs_content_storage_migrate(7)

#2 /home/customer/www/xxx/public_html/wp-content/themes/pro/cornerstone/includes/classes/Util/AdminAjax.php(60): Themeco\Cornerstone\Plugin->{closure}(Array)

#3 /home/customer/www/xxx/public_html/wp-includes/class-wp-hook.php(324): Themeco\Cornerstone\Util\AdminAjax->handler(’’)

#4 /home/customer/www/xxx/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(’’, Array)

#5 /home/customer/www/xxx/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

#6 /home/customer/www/xxx/public_html/wp-admin/admin-ajax.php(192): do_action(‘wp_ajax_cs_docu…’)

#7 {main}

thrown in /home/customer/www/xxx/public_html/wp-content/themes/pro/cornerstone/includes/integration/html-storage.php on line 95

Thanks for your help and have a great day!

Hi Giuligiuli,

Thanks for reaching out.
It is not very clear what exactly you have tried here. Can you please please copy your live site to a staging server and tried the same thing. Please make a screen casting video so we can replicate it at our end.
Please remember to deactivate all the plugins before you perform the same. If that issue still appears, please provide login credentials for your staging site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

Thanks

Hi,
thanks fo your answer. The issue persist also deactivating all plugins.
In a secure note you will find credentials for the staging site.
Thanks

Hi Giuligiuli,

I have checked your staging site but was unable to replicate the issue. Can you please explain the steps to replicate it or, else you can provide any video that helps us to recognize the problem?

Thanks

Hi,

when I try to convert from shortcode to HTML storage, from the settings of cornerstone,
after I click on “MIGRATE TO HTML”
the process started, but stopped at the 42 element of 149 elements. with the below error

Thanks

Hey @Giuligiuli,

You have 150+ pages and I suspect some server limitation is halting the process. With that said, we’d like to copy your site to our test environments. Please confirm if this is allowed and we’ll copy your site. While we wait, would you mind contacting your web host to push all the server configuration to the max and test if that resolves the issue? You can also try deleting unneeded pages or even deleting half of the pages just to test if it will complete the HTML Migration.

Thanks for testing.

Hi @christian,
thanks for your answer.
I’ve push all the server configuration to the max and test it. However did not resolve the issue.

Btw, I found a solution that made me complete the migration to HTML Storage:

Modifying this code near line 94 :

// Grab elements and send update action
$elements = json_decode($row[‘meta_value’], true);
$settings = get_post_meta($ID, ‘_cornerstone_settings’, true);
$settings = json_decode($settings, true);

to this :

// Grab elements and send update action
$elements = is_string($row[‘meta_value’]) ? json_decode($row[‘meta_value’], true) : $row[‘meta_value’];
$settings = get_post_meta($ID, ‘_cornerstone_settings’, true);
$settings = is_string($settings) ? json_decode($settings, true) : $settings;

This resolved the issue, and now I have completed all the process.
Can I place this to the live site ? or there will be fix in the next update ?

Thanks again for your help

Hey @Giuligiuli,

You can try to change that setting in your live website and after the migration, you can revert it back. I’ll rely your findings to our development team.

Thank you.

I don’t think checking if it’s an array would be fix the issue. We can probably try to fix this on our end, but I’m not entirely sure why that would happen. Do you have some special settings on your post meta table?

Hi @charlie
I don’t think I have any special settings. The website was originally created in X Theme, in 2014, with classic elements, converted to PRO this year. Most page contains classic elements, trying to convert all elements to V2 elements, I’m doing it manually and have lot of pages.

The fix above allowed us to complete the migration without any other error, and now I get the message : You’re currently using HTML Storage

So I believe that now all the pages are migrated to HTML storage. How can I check this ?
Let me know I you still need the staging site for testing…

Thanks again for your work !!

Thanks for the kind words. If you see that message you are in HTML so any new page will store it’s content as HTML. Realistically I can’t tell which of your posts caused that issue. I have a feeling it wasn’t every one of your posts that caused that though. Your code could have also worked on your site too I’m just not sure. I guess you would know if a certain post didn’t have any SEO data in the WP admin. It shouldn’t effect anything on your site though and that should work just fine.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.