Support » Theme: Astra » Imported template is broken with Gutenberg as the page builder

  • Resolved Jānis Elmeris

    (@jaanise)


    When I import an Astra template with Gutenberg block editor selected as the page builder, the images are not imported properly (and maybe something else as well).

    I’m doing a completely fresh WordPress 5.9 install in a Docker container.
    See it in the video: https://www.youtube.com/watch?v=JHPAU3vOp8c

    If I select Elementor as the page builder, the template gets imported fine.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @jaanise,

    I just tried to import the same template on my dev site and I didn’t have any issues.

    Please check that your localhost meets the system requirements as explained in this doc. And try to increase the resource by referring to this doc.

    I hope it will help.

    Kind regards,
    Herman 🙂

    Thread Starter Jānis Elmeris

    (@jaanise)

    Thank you for the reply!

    I set the suggested limits in the second document and tried again. The problem persists. In the WP admin -> Tools -> System Health I confirmed that the limits were set as suggested.

    I don’t think this is a server resource problem. No messages in the error log appear.

    It’s clear that the HTML is wrong in some areas (some double-escaping seems to happen somewhere). It’s not a matter of image files or some other files not being downloaded. See the code screenshot: https://jmp.sh/xbiIUY8

    Did you installed the Gutenberg version of the same demo template that’s in the video? Did you have a fresh, clean WordPress?

    Thread Starter Jānis Elmeris

    (@jaanise)

    I’ve since tried this with several Astra templates, all have the same problem – wrongly slash-escaped quotes in the post content.

    I tracked the problem down to a “Gutenberg Content Data Fix” as it is named in the Astra plugin code comments.

    In file wp-content/plugins/astra-sites/inc/importers/wxr-importer/class-astra-wxr-importer.php there is an if branch apparently run in the case of Gutenberg builder, explicitly adding the slashes that actually breaks the page content:

    $data['post_content'] = wp_slash( $data['post_content'] );

    If I comment out this line, the template seems to get imported fine.

    Hi @jaanise,

    Please have a look at this video to see that everything was working fine. Please let me know what I missed.

    Looking forward to hearing from you.

    Kind regards,
    Herman 🙂

    Thread Starter Jānis Elmeris

    (@jaanise)

    This is the docker-compose.yml I’m using to set up the environment:

    version: "3.1"
    
    services:
        wordpress:
          image: "wordpress:5.9.1-php7.4-apache"
          depends_on:
                - "mysql"
          ports:
              - "8590:80"
          environment:
              WORDPRESS_DB_HOST: "mysql"
              WORDPRESS_DB_NAME: "mn_jaun"
              WORDPRESS_DB_USER: "astra"
              WORDPRESS_DB_PASSWORD: "w07333dc45z8V"
          volumes:
            - "/home/janis/wpastra/mounted/files:/var/www/html"
            - "/home/janis/wpastra/mounted/php.extra.ini:/usr/local/etc/php/conf.d/php.extra.ini"
    
        mysql:
            image: "mariadb:10.6"
            environment:
                MYSQL_ROOT_PASSWORD: "example"
                MYSQL_USER: "astra"
                MYSQL_DATABASE: "mn_jaun"
                MYSQL_PASSWORD: "w07333dc45z8V"
    
            volumes:
                - "/home/janis/wpastra/mounted/db:/var/lib/mysql"
            # So IDE can connect.
            ports:
                - "3322:3306"

    “php.extra.ini” contains

    log_errors_max_len = 3072
    memory_limit = 512M
    max_execution_time = 900
    max_input_time = 900
    post_max_size = 256M
    upload_max_filesize = 720M

    @jaanise Can you confirm if cron jobs/loopback requests are working in your local environment?

    Can you take a screenshot of your site health status page and post it here? If it is not working, WordPress would detect and display a message on this page.

    Docker environments usually need extra setup to get the loopback requests working, which triggers the cron jobs by default.

    Gutenberg pages are imported and then they do need cron jobs where some processing is done.

    Thread Starter Jānis Elmeris

    (@jaanise)

    Thank you for the advice!

    The problem seems a custom (not 80) port indeed.

    Adding the following helped, the site health stopped complaining about loopback problems and the Gutenberg demo got installed fine:

    extra_hosts:
      - "localhost:172.18.0.1"

    (172.18.0.1 being the Docker gateway address.)

    Found this solution at https://stackoverflow.com/a/66139836/99904 although I’m not sure if it may have undesirable effects as well.

    It would’ve been easier if some related errors had shown up in the error log though.

    Very pleased to know that you have found the solution, @jaanise.

    And thank you for sharing the solution.

    Kind regards,
    Herman 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.