I'm trying to change WPML settings programmatically, as suggested in these posts:

My goal is to disable a WPML's feature that introduces an iframe in the source code (this WPML feature is called "Auto sign-in and sign-out users from all domains"). I need to do it programmatically, as I need to disable it only for a specific domain.

To do so, I'm trying with the following code in my functions.php:

function my_custom_filters(){
  function override_wpml_settings( $sitepress_settings ) {
        $sitepress_settings['language_per_domain_sso_enabled'] = false;
    return $sitepress_settings;
  add_filter( 'option_icl_sitepress_settings', 'override_wpml_settings' );
add_action('wpml_before_startup', 'my_custom_filters', 1);

Unfortunately that doesn't work.

What am I doing wrong?

  • for the record: after trying a number of variations and alternatives (including those suggested here wordpress.stackexchange.com/questions/36013/…), I ended up modifying the plugin source code -which is definetely a pain!. I believe there's an easy way to this but I didn't manage to get it working properly. – ludovico Oct 23 '19 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.