Home Forums Plugins Support Vidi – Video WordPress plugin CMB2 conflict with WPML

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #6634

    Hi all customer,
    In some plugins use CMB2 and CMB2 Conditionals and you can got conflict with WPML plugin with this error:
    When you try to create a new product (or page, post,…), WPML continuously gives off a pop up “You are about to change the language of (page name)” and tries to reload the page.

    In this case we found the issue from cmb2-conditionals.js

    In our plugin the path is: wp-content/plugins/haru-vidi/includes/libaries/cmb2-conditionals/cmb2-conditionals.js

    You need go to bottom of this file and find the code and change to:

    switch( true ) {
    
    // init for classic editor
    case $( '#post' ).length > 0:
    if ( $('body.post-type-product').length < 0 ) {
    CMB2ConditionalsInit( '#post', '#post .cmb2-wrap' );
    }
    
    break;
    
    // init for gutenberg editor and options pages
    // case $( '#wpwrap ' ).length > 0:
    case $( '#wpwrap .cmb2-wrap' ).length > 0:
    // CMB2ConditionalsInit( '#wpwrap', '#wpwrap .cmb2-wrap' );
    CMB2ConditionalsInit( '#wpwrap .cmb2-wrap' );
    break;
    
    // @custom init for frontend
    case $( '.cmb-form' ).length > 0:
    CMB2ConditionalsInit( '.cmb-form', '.cmb-form .cmb2-wrap' );
    break;
    
    }

    Please notice at this code:

    if ( $('body.post-type-product').length < 0 ) {
    CMB2ConditionalsInit( '#post', '#post .cmb2-wrap' );
    }

    We need trigger change event on page is not Product page.

    Hope this help you!

    ****
    Best regards,

    HaruTheme

    • This topic was modified 1 year ago by admin.
    • This topic was modified 1 year ago by admin.
    • This topic was modified 1 year ago by admin.
    • This topic was modified 1 year ago by admin.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.