Background of the issue:
I am trying to access the Translation Management page in the CMS. I encountered an issue while doing so.
Symptoms:
I receive an Error 500 when accessing the Translation Management page. The log shows: Uncaught TypeError: Argument 2 passed to WPMLCoreSharedKernelComponentPostApplicationQueryDtoPostTypeDto::__construct() must be of the type string, null given, called in /wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/Legacy/Component/Post/Application/Query/TranslatableTypesQuery.php on line 110 and defined in /wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/Core/SharedKernel/Component/Post/Application/Query/Dto/PostTypeDto.php:26
Questions:
Why am I getting an Error 500 when accessing the Translation Management page?
How can I resolve the TypeError related to PostTypeDto::__construct()?
Our 2nd tier support said, this issue is caused by the Visual Composer PRO plugin registering a custom post type (vcv_headers) without proper labels, which conflicts with WPML.
This isn’t a bug in WPML, but we’ve added a workaround on our side to avoid the error. There are two possible Workaround and you can follow any of them:
=== Please backup your database and website first for safety reasons ===
Workaround 1 (recommended):
Add the following code to your theme’s functions.php file:
Workaround 2:
You can also manually edit the plugin file:
/wp-content/uploads/visualcomposer-assets/addons/themeEditor/themeEditor/PostTypeController.php
Replace below code:
protected function registerPostType()
{
register_post_type(
With:
protected function registerPostType()
{
if (!isset($this->postNamePlural)){
$this->postNamePlural = $this->postNameSlug;
}
register_post_type(
However, this change can be lost if the plugin updates.
We also recommend reporting this to the Visual Composer PRO team so they can fix it in their code.