After migrating a large website and setting up Elegant Theme’s Divi theme, I found that all of the migrated posts had a default template set of “right sidebar”. The customer was fine with there being no modification to the posts except that they did not want the right sidebar there and, instead, wanted a full-width post. Normally, I’d bring the posts template file into the child theme and find the offending code, but I wanted a sweeping database solution that would also show up in the WordPress post template section for the client to still be able to change on a post-by-post basis if needed.
As it turns out, posts that have the default template (not explicitly set) have no entry in the meta table in WordPress’s database at all so it makes life a little easier for starting fresh. For those that have a few posts already set with templates but now you want to start from scratch, I’d recommend just doing a postmeta table search for posts with the _et_pb_page_layout meta_key set and remove them from the postmeta table.
The following SQL command (single command) is what did the trick for me. This will locate all posts that are posts (not pages) and that are published, then it will use their post IDs to create new entries into the post meta table to specify that they have a page layout of “et_full_width_page” (goodbye, default sidebar).
INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID as post_id, '_et_pb_page_layout' as meta_key, 'et_full_width_page' as meta_value FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish';