Skip Navigation

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

Problem:
If you're encountering a PHP Fatal Error when trying to access the WPML admin page, it might be due to a conflict with the Visual Composer PRO plugin, which registers a custom post type without proper labels.
Solution:
First, ensure you back up your database and website. We recommend trying one of the following workarounds:
Workaround 1 (recommended): Add the following code to your theme’s functions.php file:

add_filter( 'wpml_post_type_dto_filter', function ( $postTypeObject ) {<br />    if ( is_object( $postTypeObject ) ) {<br />        $default = $postTypeObject->name ?? '';<br />        if ( ! isset( $postTypeObject->labels ) || ! is_object( $postTypeObject->labels ) ) {<br />            $postTypeObject->labels = new stdClass();<br />        }<br />        if ( empty( $postTypeObject->name ) ) {<br />            $postTypeObject->name = $default;<br />        }<br />        if ( empty( $postTypeObject->labels->name ) ) {<br />            $postTypeObject->labels->name = $default;<br />        }<br />        if ( empty( $postTypeObject->labels->singular_name ) ) {<br />            $postTypeObject->labels->singular_name = $default;<br />        }<br />    }<br />    return $postTypeObject;<br />} );

Workaround 2: Manually edit the plugin file at /wp-content/uploads/visualcomposer-assets/addons/themeEditor/themeEditor/PostTypeController.php. Replace the existing register_post_type function with:

protected function registerPostType()<br />{<br />    if (!isset($this->postNamePlural)){<br />        $this->postNamePlural = $this->postNameSlug;<br />    }<br />    register_post_type(<br />}

Note that this change might be lost if the plugin updates. We also recommend reporting this issue to the Visual Composer PRO team for a permanent fix.

If this solution does not apply to your case, or if it seems outdated, please check the related known issues and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket with us 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 3 replies, has 0 voices.

Last updated by Chad 2 weeks, 1 day ago.

Assisted by: Noman.

Author Posts
June 16, 2025 at 8:03 pm #17140301

Chad

Background of the issue:
I am trying to reach the main WPML page in the Dashboard. I encountered an error while doing so.

Symptoms:
PHP Fatal error: Uncaught TypeError: WPMLCoreSharedKernelComponentPostApplicationQueryDtoPostTypeDto::__construct(): Argument #2 ($title) must be of type string, null given, called in /nas/content/live/sorenson2021/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/Legacy/Component/Post/Application/Query/TranslatableTypesQuery.php on line 109 and defined in /nas/content/live/sorenson2021/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/Core/SharedKernel/Component/Post/Application/Query/Dto/PostTypeDto.php:26

Questions:
Why am I encountering a fatal error when trying to access the WPML admin page?
How can I resolve the TypeError related to PostTypeDto::__construct()?

June 17, 2025 at 10:57 am #17141964

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. Could you please take a full backup of your site and then temporarily deactivate the Visual Composer plugin? After that, try accessing the WPML >> Translation Management page and see if the error persists.

I’ve recently received a similar report, which has already been escalated to our 2nd tier support team. I’ll link your ticket to that report and keep you updated as soon as I hear back.

Kindly let me know the results, so that we can proceed accordingly.

Thank you for your cooperation

June 18, 2025 at 2:27 pm #17147086

Chad

Thank you - yes, that was my report from earlier. Unfortunately, I missed the email reply and it was closed. In the original chat thread, which I can share if needed, we created a test site and then determined that the problem arose as soon as the PREMIUM license was installed for Visual Composer, so Visual Composer is OK until it is upgraded to premium, and then we get the error on the string translation page.

Let me know if there is anything else I can provide or do!

June 18, 2025 at 4:55 pm #17147807

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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:

add_filter( 'wpml_post_type_dto_filter', function ( $postTypeObject ) {
	if ( is_object( $postTypeObject ) ) {
		$default = $postTypeObject->name ?? '';
		if ( ! isset( $postTypeObject->labels ) || ! is_object( $postTypeObject->labels ) ) {
			$postTypeObject->labels = new stdClass();
		}
		if ( empty( $postTypeObject->name ) ) {
			$postTypeObject->name = $default;
		}
		if ( empty( $postTypeObject->labels->name ) ) {
			$postTypeObject->labels->name = $default;
		}
		if ( empty( $postTypeObject->labels->singular_name ) ) {
			$postTypeObject->labels->singular_name = $default;
		}
	}
	return $postTypeObject;
} );

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.

Kindly let me know the results,
Thank you

June 18, 2025 at 5:09 pm #17147845

Chad

I've tested the first workaround and it has solved our problem. Thank you!