sitepress->set_setting( 'language_negotiation_type', $icl_language_negotiation_type ); $response = true; if ( ! empty( $language_domains ) ) { $this->sitepress->set_setting( 'language_domains', $language_domains ); } if ( 1 == $icl_language_negotiation_type ) { $urls = $this->sitepress->get_setting( 'urls' ); $urls['directory_for_default_language'] = $use_directory ? true : 0; if ( $use_directory ) { $urls['show_on_root'] = $use_directory ? $show_on_root : ''; if ( 'html_file' == $show_on_root ) { $urls['root_html_file_path'] = $root_html_file_path ? $root_html_file_path : ''; } else { $urls['hide_language_switchers'] = $hide_language_switchers ? $hide_language_switchers : 0; } } $this->sitepress->set_setting( 'urls', $urls ); } $this->sitepress->set_setting( 'xdomain_data', $icl_xdomain_data ); $this->sitepress->save_settings(); } if ( $response ) { $permalinks_settings_url = get_admin_url(null, 'options-permalink.php'); $save_permalinks_link = '' . _x( 're-save the site permalinks', 'You may need to {re-save the site permalinks} - 2/2', 'sitepress' ) . ''; $save_permalinks_message = sprintf( _x( 'You may need to %s.', 'You may need to {re-save the site permalinks} - 1/2', 'sitepress' ), $save_permalinks_link ); wp_send_json_success( $save_permalinks_message ); } else { wp_send_json_error( __( 'Error', 'sitepress' ) ); } } } }