Fatal Error when exporting the WordPress theme (solved)

Hello everyone,

After updating to version 8.62, I receive a “Fatal Error” in the browser after exporting the WordPress theme file.

After investigation with the WordPress Debugger, it appears Block elements are causing this error. If I remove them, the error does not occur.

Can anyone confirm this issue?

p.s.: When I revert to version 8.5, the export works without errors.

1 Like

Working fine on my side, also with ver 8.6.2 and WordPress 6.8.3.
I just re-exported my blocks with no issues.

1 Like

@red-rosefields Thank you for your feedback.

Unfortunately, I am getting this error message during the export in 6.8.2. I am attaching a screenshot—perhaps someone can make sense of the message and give me a tip.

What operating system are you working on? Mac or Windows?

i am on latest Mac OS. That looks like a php issue.
Have you tried asking AI?

Ok, I asked the AI. The answer: “This error almost always occurs when the theme (containing the PineGrow blocks) is executed, but the PineGrow Block Converter or the necessary helper files are missing or not loaded correctly.”
My question: Why does the export work without problems in version 8.5?

@wpmonster , can you clear your theme (Wordpress menu > Clear the theme folder), and then do a fresh export, and see if this fixed it?

@TechAkayy I have already tried all of the following:

  • Deleting the theme folder
  • Regenerating the functions.php
  • Test on another server
    Unfortunately, with no effect.

However, I can narrow down the error: It is definitely caused by the “blocks” folder created within the theme, specifically the files in that folder, generated by version 8.62. If I copy and replace this folder from the same theme, which I created with version 8.5, the site runs fine. I am absolutely at a loss.

I can now narrow down the error even further. The generated _register.php file writes the following code on line 3:PG_Blocks_v4::register_block_type( array( .... If I change this to: PG_Blocks_v3::register_block_type( array( .... I no longer get an error message.

Can anyone make sense of this and tell me where the problem lies?

I can now narrow down the error even further. The generated _register.php file writes the following code on line 3:PG_Blocks_v4::register_block_type( array( .... If I change this to: PG_Blocks_v3::register_block_type( array( .... I no longer get an error message.

Can anyone make sense of this and tell me where the problem lies?

Here is another hint: Pinegrow creates the file wp_pg_blocks_helpers.php in the inc folder in my project with an older version. Version: 3.0 If I replace the file with the current version 4.0 from another project in the Theme folder, the WordPress instance works.

What could be the reason that the file wp_pg_blocks_helpers.php is not being created in the current version in my project?

1 Like

It can sometimes be useful to do a full export after you’ve previously done a “Clear the Theme Folder”

@Emmanuel Thanks for the suggestion, I’ve already tried all that without success.

I was working with a WP theme yesterday and I didn’t have any issues. But I’ll let you know.

Actually the only time I had an export problem was when there was a syntax error related to svg markup and using multi resolutions on an image in a Block. It was difficult to trace.

@PeteSharp Thank you for your response. The problem is that Pinegrow is generating a wrong version of the wp_pg_blocks_helpers file for me in this project. However, I can’t figure out why that is the case. In another project, the files are created without any issues.

1 Like

For sure, sorry I wasn’t suggesting the issues were the same.

I’m building exclusively WP themes over the next few weeks, so I’ll report back if I have a similar issue.

@wpmonster for some reason the correct resource is not copied to the inc folder of the exported theme.

Can you check if you have this section in functions.php?

/* Pinegrow generated Include Resources Begin */
require_once "inc/custom.php";
if( !class_exists( 'PG_Helper_v2' ) ) { require_once "inc/wp_pg_helpers.php"; }
if( !class_exists( 'PG_Blocks_v4' ) ) { require_once "inc/wp_pg_blocks_helpers.php"; }

    /* Pinegrow generated Include Resources End */

@matjaz I have the following entries in the functions.php file:

/* Pinegrow generated Include Resources Begin */

require_once "inc/custom.php";

if( !class_exists( 'PG_Helper_v2' ) ) { require_once "inc/wp_pg_helpers.php"; }
if( !class_exists( 'PG_WC_Helper' ) ) { require_once "inc/wc_pg_helpers.php"; }
if( !class_exists( 'PG_Blocks_v4' ) ) { require_once "inc/wp_pg_blocks_helpers.php"; }

/* Pinegrow generated Include Resources End */

@wpmonster do you have a copy of older (v3) inc/wp_pg_blocks_helpers.php present in your SOURCE project folder? This then gets copied on export and overwrites the correct file.

1 Like

@matjaz That was the exact problem! After deleting the file in the Source Folder, the file in the Export Folder is generated correctly. It’s one of those things you wouldn’t necessarily think of right away. Thank you so much for the help.

1 Like

@wpmonster great, glad it works now!

2 Likes