Fixing "This file should not be imported in this context." Layout Error

This post may contain referral links which may earn a commission for this site

Fixing "This file should not be imported in this context." Layout Error

Having trouble exporting and importing Divi builder layouts? These tips might help.

Note: You can adjust the values width, margin and height in the code to fit your needs.

I hope this tutorial will help you to make your Divi blog look better, good luck!

Note: You can adjust the values width, margin and height in the code to fit your needs.

I hope this tutorial will help you to make your Divi blog look better, good luck!

Want get more out of Divi?

Hundreds of new features for Divi
in one easy-to-use plugin

54 Comments

  1. Thanks for the help on this! Was trying to upload a blog template to the Library. Had never used the Portability > Import feature on an actual page before.

    Reply
    • You’re welcome, Graeme!

      Reply
  2. Omg, many thanks!!! Use Classic Editor and it's ok now.

    Reply
    • Great! I'm glad you got it working, Olga!

      Reply
  3. Thank you very much it helped me a lot !

    Reply
  4. Resetting the permalinks in Divi 4 can also resolve some instances of this problem.

    Reply
    • Thanks for the tip, Tom!

      Reply
    • all of this tips does not work

      Reply
      • Sorry to hear it, Jaxur. If you like, send me a copy of your layout file via my contact form and I'll see if I can figure out what’s wrong. If you select “bug report” on the contact form you’ll get an autoreponse email to which you can attach the file. Thanks!

        Reply
  5. Thanks a ton!

    Reply
    • You're welcome, Tina!

      Reply
  6. Which files need the permissions changing?

    Reply
    • I managed to solve this issue. In my case, the uploads folder was missing from my WP install. My web host (for some reason, prob security) had not allowed the creation of an uploads folder. I created one in FTP (filezilla) and it works now. 🙂

      Reply
      • Okay, great! Thanks for the update, Michael 🙂

        Reply
  7. Same mistake…. Nothing works…. Divi Support also not find nothing, but I get it… 😉
    I dont know why, but if you open the .json file with a text editor, the first line of the file was empty.
    Just Delete the first EMPTY line and the import works fantastic…

    Reply
    • Awesome, thanks for sharing that Pino. One thing that springs to mind is that occasionally plugins / child themes will accidentally output blank lines (due to closing PHP tags before the end of a file). Perhaps this is where your blank line came from… If you have a lot of layouts to export, you could try disabling other plugins before doing so to see if that gets rid of the blank line and saves you some work. Anyway, glad you figured it out and thanks again 🙂

      Reply
  8. Hello! Thanks so much for this.

    "From Page editor > Where import/export icon is. This one did work."

    I'm trying to find the import/export icon in the Page editor. I'd be grateful if you could upload a screenshot. Thanks!

    Reply
    • Hi Tania, I've just added some explanation and a screenshot to that section – I hope it helps!

      Reply
  9. Hi, Dan, thanks for sharing your tips.
    I also wanted to share what was causing in my case the issue, just in case anyone is in the same situation.
    I have a local copy of my site, and it had the debug mode activated. So the exported json started with a debug notice:
    "
    Notice: Constant WP_POST_REVISIONS already defined in…"

    After reading in this article that the file should start with context = "et_builder_layouts" (or context = "et_builder") I deleted all lines before it, and, once I did it, the issue was fixed.

    Reply
    • Ah, interesting. Thanks for that, Pablo – I hadn't come across that before, but it makes sense. I guess another fix (for anyone not wanting to edit the file itself) would be to disable debugging in wp-config.php and re-export the file. Thanks again!

      Reply
  10. Thank you! You saved me easily over 100 hours of work. You're a legend! Thanks again. 🙂

    Reply
    • You're welcome, Jaye!

      Reply
  11. Thanks mate. Had same issue. Importing into the page and not the library did the trick

    Reply
  12. Thank you for this amazing tip. God bless you

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Hundreds of new features for Divi
in one easy-to-use plugin

54 Comments

  1. Thanks for the help on this! Was trying to upload a blog template to the Library. Had never used the Portability > Import feature on an actual page before.

    Reply
    • You’re welcome, Graeme!

      Reply
  2. Omg, many thanks!!! Use Classic Editor and it's ok now.

    Reply
    • Great! I'm glad you got it working, Olga!

      Reply
  3. Thank you very much it helped me a lot !

    Reply
  4. Resetting the permalinks in Divi 4 can also resolve some instances of this problem.

    Reply
    • Thanks for the tip, Tom!

      Reply
    • all of this tips does not work

      Reply
      • Sorry to hear it, Jaxur. If you like, send me a copy of your layout file via my contact form and I'll see if I can figure out what’s wrong. If you select “bug report” on the contact form you’ll get an autoreponse email to which you can attach the file. Thanks!

        Reply
  5. Thanks a ton!

    Reply
    • You're welcome, Tina!

      Reply
  6. Which files need the permissions changing?

    Reply
    • I managed to solve this issue. In my case, the uploads folder was missing from my WP install. My web host (for some reason, prob security) had not allowed the creation of an uploads folder. I created one in FTP (filezilla) and it works now. 🙂

      Reply
      • Okay, great! Thanks for the update, Michael 🙂

        Reply
  7. Same mistake…. Nothing works…. Divi Support also not find nothing, but I get it… 😉
    I dont know why, but if you open the .json file with a text editor, the first line of the file was empty.
    Just Delete the first EMPTY line and the import works fantastic…

    Reply
    • Awesome, thanks for sharing that Pino. One thing that springs to mind is that occasionally plugins / child themes will accidentally output blank lines (due to closing PHP tags before the end of a file). Perhaps this is where your blank line came from… If you have a lot of layouts to export, you could try disabling other plugins before doing so to see if that gets rid of the blank line and saves you some work. Anyway, glad you figured it out and thanks again 🙂

      Reply
  8. Hello! Thanks so much for this.

    "From Page editor > Where import/export icon is. This one did work."

    I'm trying to find the import/export icon in the Page editor. I'd be grateful if you could upload a screenshot. Thanks!

    Reply
    • Hi Tania, I've just added some explanation and a screenshot to that section – I hope it helps!

      Reply
  9. Hi, Dan, thanks for sharing your tips.
    I also wanted to share what was causing in my case the issue, just in case anyone is in the same situation.
    I have a local copy of my site, and it had the debug mode activated. So the exported json started with a debug notice:
    "
    Notice: Constant WP_POST_REVISIONS already defined in…"

    After reading in this article that the file should start with context = "et_builder_layouts" (or context = "et_builder") I deleted all lines before it, and, once I did it, the issue was fixed.

    Reply
    • Ah, interesting. Thanks for that, Pablo – I hadn't come across that before, but it makes sense. I guess another fix (for anyone not wanting to edit the file itself) would be to disable debugging in wp-config.php and re-export the file. Thanks again!

      Reply
  10. Thank you! You saved me easily over 100 hours of work. You're a legend! Thanks again. 🙂

    Reply
    • You're welcome, Jaye!

      Reply
  11. Thanks mate. Had same issue. Importing into the page and not the library did the trick

    Reply
  12. Thank you for this amazing tip. God bless you

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *