Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are experiencing a fatal error when saving or editing a translation page in WordPress, where WPML's hook crashes due to expecting a WP_Post object but receives null. This issue persists even after updating to WPML 4.9.2.
Solution:
We have investigated the issue and found that it appears to be specific to your hosting environment rather than a bug in WPML itself. We recommend contacting your hosting provider to ensure that the REST API is not blocked and to temporarily disable any restrictive security layers that might be interfering with the save process. Additionally, consider whitelisting WPML-related requests from these protections. If the problem continues, you might need to consider changing your server.
For more details on REST API dependencies, please visit https://wpml.org/documentation/support/rest-api-dependencies/.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, please open a new support ticket for further assistance.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 11 replies, has 0 voices.

Last updated by yavuzS-4 2 weeks, 1 day ago.

Assisted by: Andrey.

Author Posts
April 6, 2026 at 5:13 pm #17952114

yavuzS-4

Hi,

The site migration is now complete and oss-material.ca is properly registered as an independent site. However, the original fatal error still persists even after updating to WPML 4.9.2.

The error occurs when saving or editing an existing translation page in the WordPress editor. WordPress attempts to create a post revision during save, wp_insert_post returns null, and WPML's hook crashes because it expects a WP_Post object.

Full error details:

An error of type E_ERROR was caused in line 55 of the file:
wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/UserInterface/Web/Infrastructure/WordPress/CompositionRoot/Config/Event/Translation/Links/ItemUpdateEvent.php

Error message:
Uncaught TypeError: Argument #2 ($post) must be of type WP_Post, null given, called in wp-includes/class-wp-hook.php on line 343

Stack trace summary:
- edit_post() is called
- wp_update_post() triggers wp_insert_post()
- wp_after_insert_post() fires
- wp_save_post_revision_on_insert() is called
- wp_save_post_revision() → _wp_put_post_revision() → wp_insert_post() returns null
- do_action('save_post', 2572, NULL) is fired with null post
- WPML's ItemUpdateEvent closure receives null instead of WP_Post and crashes

This appears to be a bug in WPML 4.9.2 where the ItemUpdateEvent hook does not handle a null $post argument gracefully. Could you please escalate this as a bug report or provide a fix?

Thank you!

April 7, 2026 at 1:22 pm #17954460

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for contacting WPML support.

Did you migrate the site using the All-in-One WP Migration plugin? If so, you may be encountering a known issue.

Please follow the workaround described here to resolve it:
https://wpml.org/errata/all-in-one-wp-migration-database-error-missing-uuid-column-after-migration/

April 7, 2026 at 2:07 pm #17954536

yavuzS-4

Hi Andrey,

I used UpdraftPlus plugin for migration.

April 7, 2026 at 2:14 pm #17954556

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Are you sure that the entire database and all files were migrated correctly?

Would it be possible to perform a test migration to a local environment using an alternative method (e.g., a plugin like Duplicator or All-in-One WP Migration within the fix above) and check whether the issue still occurs?

I’ve also enabled debug information for this support ticket. Please follow this guide to retrieve it from your site and share it

April 7, 2026 at 2:20 pm #17954562

yavuzS-4

Same setup and content works fine on another server where I copied the content from.
I also migrated the very same web page on another (3rd one for testing purposes) server, and that works fine too.
Also used UpdraftPlus for the test migration.

April 7, 2026 at 2:25 pm #17954585

yavuzS-4

added the info.

April 7, 2026 at 2:27 pm #17954588

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I suspect this may be related to a server configuration issue or possibly corrupted database entries.

I would need temporary access to your site (wp-admin and FTP)—preferably to a staging or test environment where the issue can be reproduced. When you submit your next reply, you will find the required fields below the comment area. Please note that this information is private and will only be visible to you and me.

Additionally, please provide the exact steps to reproduce the issue, so I can follow the same process on my end.

Let me know if I have your permission to temporarily install the Adminer plugin.

April 7, 2026 at 6:41 pm #17955066

yavuzS-4

The fatal error sometimes occurs.
I use WordPress editor to create translated versions of the pages.
I do not use translation dashboard since I need to change page content and layout when necessary.

So to create a language version of the related page I click + sign on the right of the page name (ie: please see the attached 001.png as an example to create the Portuguese version of the page).

Then I copy the content from English verison and then change all the text (content) to that language (ie: Portuguese).

After clicking publish, WordPress normally saves. It generally does.

But sometimes I get that fatal error (did not get a screenshot but it says: "There has been a critical error on this website. Please check your site admin email inbox for instructions. If you continue to have problems, please try the support forums. Learn more about troubleshooting WordPress.").

The interesting part is that, the page is saved despite that error.

I'm not sure if there's been a firewall delay just about that saving process and WPML can not communicate with its servers at that exact delay period, or there's a mistake on the database itself. I'm not a code guy, just try to understand and solve the issue.

001.png
April 8, 2026 at 1:58 pm #17957066

yavuzS-4

Hi there,

Following up on this ticket. Here is a summary of what has been done so far and the current status on hidden link :

**What was done:**
- WPML Multilingual CMS updated from 4.8.4 to 4.9.2 via FTP
- WPML String Translation updated from 3.4.1 to 3.5.1 via FTP
- Site migration completed: oss-material.ca is now properly registered as an independent site, alias to tgsteels.com has been removed
- Hosting confirmed ModSecurity has been disabled on the server

**Current status:**
The fatal error in ItemUpdateEvent.php on line 55 still persists. It is now confirmed to be triggered not only when saving/editing translation pages, but also when TablePress performs a wp_insert_post() call (e.g. when copying a table).

This confirms the bug is in WPML's ItemUpdateEvent hook, which does not handle a null $post argument gracefully. Any plugin that calls wp_insert_post() can trigger this crash.

Full error:
Uncaught TypeError: Argument #2 ($post) must be of type WP_Post, null given in ItemUpdateEvent.php on line 55

Call stack confirms the trigger:
- TablePress_Table_Model::copy() calls wp_insert_post()
- wp_insert_post() returns null
- do_action('save_post', NULL) fires
- WPML's ItemUpdateEvent closure crashes

Could you please escalate this as a bug and provide a fix or patch?

Here is the full bug report:

Uncaught Error: WPML\UserInterface\Web\Infrastructure\WordPress\CompositionRoot\Config\Event\Translation\Links\ItemUpdateEvent::WPML\UserInterface\Web\Infrastructure\WordPress\CompositionRoot\Config\Event\Translation\Links\{closure}(): Argument #2 ($post) must be of type WP_Post, null given, called in /data/19/7/77/157/7077646/user/8058180/htdocs/wordpress1/wp-includes/class-wp-hook.php on line 343 in /data/19/7/77/157/7077646/user/8058180/htdocs/wordpress1/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/UserInterface/Web/Infrastructure/WordPress/CompositionRoot/Config/Event/Translation/Links/ItemUpdateEvent.php on line 55
Call stack:
1. WPML\UserInterface\Web\Infrastructure\WordPress\CompositionRoot\Config\Event\Translation\Links\ItemUpdateEvent::WPML\UserInterface\Web\Infrastructure\WordPress\CompositionRoot\Config\Event\Translation\Links\{closure}(2705, NULL) wp-includes/class-wp-hook.php:343
2. WP_Hook::apply_filters(NULL, array) wp-includes/class-wp-hook.php:365
3. WP_Hook::do_action(array) wp-includes/plugin.php:522
4. do_action('save_post', 2705, NULL, false) wp-includes/post.php:5194
5. wp_insert_post(array, true) wp-content/plugins/tablepress/models/model-post.php:121
6. TablePress_Post_Model::insert(array) wp-content/plugins/tablepress/models/model-table.php:358
7. TablePress_Table_Model::add(array, 'copy') wp-content/plugins/tablepress/models/model-table.php:424
8. TablePress_Table_Model::copy('8') wp-content/plugins/tablepress/controllers/controller-admin.php:1323
9. TablePress_Admin_Controller::handle_get_action_copy_table('') wp-includes/class-wp-hook.php:341
10. WP_Hook::apply_filters('', array) wp-includes/class-wp-hook.php:365
11. WP_Hook::do_action(array) wp-includes/plugin.php:522
12. do_action('admin_post_tablepress_copy_table') wp-admin/admin-post.php:82

Thank you!

April 9, 2026 at 6:56 am #17958134

yavuzS-4

Hi,

Following up with an update on both issues.

**REST API 403 Forbidden Issue:**
After extensive troubleshooting with the hosting provider, it was confirmed that the server's firewall is blocking loopback requests to the REST API endpoint (wp-json/wpml/v1/rest/status), returning 403 Forbidden. The hosting team disabled ModSecurity but the issue persisted, suggesting another security layer (possibly Imunify360 or a similar firewall) is responsible.

As a workaround, we implemented the following code via the Code Snippets plugin, which intercepts WPML's REST API status check before it reaches the server and returns a synthetic 200 OK response:

add_filter( 'pre_http_request', function( $pre, $args, $url ) {
if ( strpos( $url, 'wpml/v1/rest/status' ) !== false ) {
return array(
'response' => array( 'code' => 200, 'message' => 'OK' ),
'body' => '{"rest_enabled":true}',
'headers' => array(),
'cookies' => array()
);
}
return $pre;
}, 10, 3 );

After applying this, the admin panel became significantly faster and the 403 errors stopped.

**ItemUpdateEvent Fatal Error:**
The fatal error in ItemUpdateEvent.php line 55 (Argument #2 ($post) must be of type WP_Post, null given) also appears to have stopped occurring since applying the workaround above, suggesting the two issues may be related.

We are sharing this in case it is useful for your team to investigate the root cause. The site is now stable.

Thank you!

April 9, 2026 at 10:44 am #17959059

yavuzS-4

Hi,

Following up on the ItemUpdateEvent fatal error. The issue is still occurring.

Current behavior:
- When saving a page, the content IS saved successfully
- However, immediately after saving, WordPress attempts to create a post revision
- During the revision creation, wp_insert_post() returns null
- WPML's ItemUpdateEvent hook crashes because it receives null instead of a WP_Post object
- The admin page then shows a fatal error screen
- I have to navigate away and continue from another browser tab

This is happening when editing translation pages in the WordPress classic editor.

Full error:
Uncaught TypeError: Argument #2 ($post) must be of type WP_Post, null given in ItemUpdateEvent.php on line 55

Call stack confirms:
- edit_post() is called
- wp_update_post() saves the page successfully (post ID 2759)
- wp_save_post_revision_on_insert() tries to create a revision (post ID 2770)
- wp_insert_post() for the revision returns null
- do_action('save_post', 2770, NULL) fires with null post
- WPML's ItemUpdateEvent closure crashes

Note: The REST API 403 issue has been resolved via a pre_http_request filter workaround. This ItemUpdateEvent error is a separate, unresolved issue.

Could you please provide a fix or patch for this bug?

Thank you!

April 9, 2026 at 12:33 pm #17959397

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for providing the additional details.

I’ve taken a close look at the issue and attempted multiple times to reproduce the error by following your steps when saving a post translation, but I was unable to replicate it. I also enabled the debug.log to monitor for any related errors during the process.

Based on my findings, the issue appears to be specific to your hosting environment. This is why I’m unable to escalate it further at this stage—most likely, it would not be reproducible on a local setup at all. This strongly suggests that the root cause is related to server configuration or security settings (layers), as you already mentioned, and you have already tested the same site on different servers, where everything works as expected.

It’s possible that certain server-side security layers (such as firewalls, mod_security, Imunify360, or similar protections) are interfering with the save process, which could result in the fatal error you’re experiencing.

Regarding the REST API, this is not a bug. The REST API should not be blocked, as WPML relies on it for core functionality, just like WordPress itself.

More details here:
https://wpml.org/documentation/support/rest-api-dependencies/

I would recommend contacting your hosting provider again and asking them to ensure the REST API is not blocked. Temporarily disable any restrictive security layers for testing. Or whitelist/exclude WPML-related requests from those protections.

If it persists, consider changing the server as well, since we are unable to fix this on our end.

April 9, 2026 at 6:07 pm #17960382

yavuzS-4

Dear Andrey,

Thank you for your patience and efforts in troubleshooting this issue.

I have decided to migrate the website to a new server environment that is specifically optimized for WordPress. I’m hopeful that on this new infrastructure, I won't need to rely on the workaround we implemented to bypass the previous server's limitations.

Thanks again for your support.

Best regards,