I recently encountered an issue where I was migrating a bunch of WordPress posts from an old site to a newly designed on (using a Elegant Themes Divi child theme). I found that all of the posts had imported using a null / default “Page Layout” type (defaulting to a Page Layout of “Right Sidebar”). I really needed all of these posts to conform and have the Page Layout of “Full Width” since that’s what the designed called for and it seemed unnecessary to have to hack away at the actual “Right Sidebar” post template just for this.
Enter the database…
The mystical forest of WordPress data was surely the place to update all posts at once. Surprisingly, it wasn’t that obvious where to find how this was set. To make it more difficult, I (later) found that the posts had truly imported without a defined Page Layout (making searching for “Right Sidebar” pointless).
Long story short – If you’re using Elegant Themes, you need to create entries in the wp_postmeta table for each of your posts and set the meta_key -> _et_pb_page_layout to whatever you want. In my case, I set the meta_value field to et_full_width_page.
Since I knew all of my published (imported) posts needed to be updated, I did a sweeping MySQL (actually MariaDB) insert with select as follows:
INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID, ‘_et_pb_page_layout’, ‘et_full_width_page’ FROM wp_posts WHERE post_type = ‘post’ AND post_status = ‘publish’;