Hi!
Cornerstone saves JSON data about the layout of each page in a _cornerstone_data
entry in the wp_postmeta
table.
When I use WordPress’s built-in Tools > Export feature to export pages to an XML file, and then I use the Tools > Import > WordPress feature on a different site to import the XML file, these JSON strings get imported into the target site’s database with extra backslashes (not present in the origin site’s database) that make the JSON invalid and prevent Cornerstone from recognizing its own content on any of the pages.
The XML file contains these extra backslashes because your wxr_export_skip_postmeta
filter (in cornerstone/includes/classes/admin/class-wp-export.php
) calls wp_slash
on the $meta->meta_value
variable. I don’t think it should. The wxr_cdata
function, which WordPress’s exporter calls on the contents of all wp:meta_value
tags by default, wraps the string in a CDATA section and splits any occurrences of ]]>
within the string. Doesn’t that mean no further escaping is required?
I know there are other reasons why exporting Cornerstone content from one site to another might not work perfectly, but the fact that it’s impossible due to over-escaping (or under-unescaping) seems like a bug. If you wanted to make it impossible, you could have added the _cornerstone_data
field to the $meta_skip_list
array instead of the $meta_slash_list
array, right?
By the way, I see that some other users have asked for a way to export font and color definitions from Cornerstone. Just adding a +1 to that.
Thanks!
WordPress 6.0
Pro 5.1.5