Friday , December 20 2024

Visualcomposer – error array_search() expects parameter 2 to be array, null given (ContentUrlReplaceController.php)

This error appeared after the transfer of the site to another domain. Due to this error, there is no access to /wp-admin, and this error is displayed on the site above the content:

Warning: array_search() expects parameter 2 to be array, null given in /wp-content/plugins/visualcomposer/visualcomposer/Modules/FrontView/ContentUrlReplaceController.php on line 68

The error in the admin panel:

Warning: array_search() expects parameter 2 to be array, null given in /wp-content/plugins/visualcomposer/visualcomposer/Modules/FrontView/ContentUrlReplaceController.php on line 68

Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/visualcomposer/visualcomposer/Modules/FrontView/ContentUrlReplaceController.php:68) in /wp-includes/pluggable.php on line 1265

Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/visualcomposer/visualcomposer/Modules/FrontView/ContentUrlReplaceController.php:68) in /wp-includes/pluggable.php on line 1268

Solution to fix Visualcomposer issue without disabling the plugin

Edit the file /wp-content/plugins/visualcomposer/visualcomposer/Modules/FrontView/ContentUrlReplaceController.php, find line 68 and comment the following code:

$siteKey = array_search($siteUrl, $siteUrls['prevUrls']);
        if (false !== $siteKey) {
            unset($siteUrls['prevUrls'][ $siteKey ]);
            $optionsHelper->set('siteUrls', ['prevUrls' => $siteUrls['prevUrls'], 'currentUrl' => $siteUrl]);
        }

About admin

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

Your email address will not be published. Required fields are marked *