Fix Custom Sidebar Plugin Conflict with OceanWP Extra Plugin in WordPress

I was working on a project using OceanWP which comes with the ocean-extra plugin. I installed Custom Sidebars plugin by WPMU Dev to add more functionality and flexibility to the sidebars.

After activating the plugin, and making some changes in the sidebar’s widget options. It just keeps loading as you can see in the image below.

image

When checking the dev console, there’s an Uncaught TypeError: settings.data.search is not a function.

See the following image:

image

Clicking on the widgets.php file will show the file and the line where the error is coming. And yes, it comes from the about-me.php and social.php in ocean-extra/includes/widgets directory.

image

I did a temporary fix by updating some lines from:

if ( settings.data.search( 'action=save-widget' ) != -1 && settings.data.search( 'id_base=' + widget_id_base) != -1 ) {
   oceanwpSortServices();
}

to the following:

if (typeof(settings.data) !== 'undefined' && typeof(settings.data.search) !== 'undefined') {
   if ( settings.data.search( 'action=save-widget' ) !== 'undefined' && typeof(settings.data.search( 'id_base=' + widget_id_base)) !== 'undefined' ) {
      oceanwpSortServices();
   }
}

Though that fixed the custom sidebars plugin conflict with the ocean extra plugin. I still have to do that over and over again every time there’s an update from ocean wp theme core files/plugins.

So, I also created a PR in oceanwp/ocean-extra in Github, and hopefully, an update about the issue with the plugin author’s fix will be published soon.

Cromwell Bayon

He is a self-tutored programmer and a Full-Stack Developer. He strives to excel in the newest technology as possible. He has a very high sense of technicality and analytical skills which allows him to resolve any kind of issues related to technology. He also loves woodworking. Read more about him here...

Add comment

E-mail is already registered on the site. Please use the Login form or enter another.

You entered an incorrect username or password

Sorry, you must be logged in to post a comment.