Background of the issue:
I am trying to view a normal post or page on my WordPress site, but I encountered a fatal error. The issue can be seen on this page: hidden link. The error message is: Fatal error: Uncaught TypeError: Argument 2 passed to WPMLUserInterfaceWebInfrastructureWordPressCompositionRootConfigEventTranslationLinksItemUpdateEvent::WPMLUserInterfaceWebInfrastructureWordPressCompositionRootConfigEventTranslationLinks{closure}() must be an instance of WP_Post, null given, called in /home/childrenlux25/public_html/wp-includes/class-wp-hook.php on line 326 and defined in /home/childrenlux25/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/UserInterface/Web/Infrastructure/WordPress/CompositionRoot/Config/Event/Translation/Links/ItemUpdateEvent.php:55.
Symptoms:
I received a fatal error message indicating a TypeError related to WPML and WP_Post when trying to view a page.
Questions:
How can I resolve the fatal error related to WPML and WP_Post?
What steps should I take to fix the TypeError on my WordPress site?
Please follow these steps to isolate the cause of the issue:
- Create a full site backup or create a staging site with a copy of the live site (you can use the WP Staging plugin for free)
- Update any outdated plugins or themes
- Flush any cache memory that might exist
- Deactivate all plugins, including the WPML ones
- Activate a default WordPress theme, like Twenty Twenty
- Activate the WPML plugins
- If the error disappeared, start by activating the theme and then the rest of the plugins, one by one, until the issue appears again and you find the culprit
Can you tell me the results of the steps described above?