Import thousands of pages into Cornerstone

I need to migrate ~2,000 flat HTML pages into a WordPress site using X Theme.

I could build a single example of a page in Cornerstone, then use the wp_post database record as a template, writing a script to swap out the titles, content, images. Then it’s just a SQL statement to insert.

However, looks like a lot of the Cornerstone content is stored in wp_postmeta. Is this relationship defined anywhere?

I’m assuming you don’t have a content import tool, but correct me if I’m wrong.

Can you provide some guidance on the best way to import this content? Happy to write my own scripts but I need to understand better the relationship between the two tables.

I could import them as regular WordPress content but I hate to force the content editors to use Cornerstone for some pages and the default WordPress WYSIWYG for others.

Thanks for any assistance.

Hi there,

The main content of the Cornerstone is stored in the post table. For example, I have a main page with the ID of 834:

Besides the main content, Cornerstone has additional information such as generated Styles or additional settings that are stored in the post_meta table.

To be able to find the meta information of the page you should have the ID of the page. Here are the Cornerstone related table entries in post_meta for my case:

As you can see there is a post_id column that has the same ID of their page in question (834).

Also, the X theme itself adds extra information in the post_meta have for the page. The data is usually whatever you set in the page setting such as sliders above the Masthead and so on:

We cannot help you write such a script unfortunately, but I wonder if our new template manager might be of any help:

The feature is not available yet and it will be released in the upcoming update.

Thank you.

Thanks @christopher.amirian for such a thoughtful and detailed response, this is super helpful.

So looks like the only record in wp_post_meta that I’ll need to customize for my SQL import would be the _cornerstone_data record?

E.g., let’s say 2,000 of these are “article” pages. I build 1 as an example in Cornerstone. Then I take the wp_post record and wp_postmeta records and use them as a template, writing a Python or PHP script that swaps out the relevant text content where necessary and inserts them into the DB.

Does that battle plan sound reasonable to you? I was totally unfamiliar with Cornerstone until recently so I just wanted to check with you before I got too far down the rabbit hole and had to take a different approach.

Thanks again for your assistance.

Hey @gracelinks,

Yes and one thing to note is Cornerstone data is stored as serialized data so you need to take that into account.


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