WordPress.org

Support

Support » Plugins and Hacks » Nice Search » WPML compatibility

WPML compatibility

  • Don’t know if the author is still monitoring this support page, however, for all of you out there using WPML plugin for multilanguage, I’ve added just two simple lines to make this plugin WPML compatible. So here is the modded code for function cws_nice_search_redirect:

    function cws_nice_search_redirect() {
    	global $wp_rewrite;
    	if ( !isset( $wp_rewrite ) || !is_object( $wp_rewrite ) || !$wp_rewrite->using_permalinks() )
    		return;
    
    	$search_base = $wp_rewrite->search_base;
    	if ( is_search() && !is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
    		if ( function_exists('icl_get_home_url') ){
    			wp_redirect( icl_get_home_url()."{$search_base}/" . urlencode( get_query_var( 's' ) ) ) ;
    		}else{
    			wp_redirect( home_url("/{$search_base}/" . urlencode( get_query_var( 's' ) ) ) );
    		}
    		exit();
    	}
    }

    https://wordpress.org/plugins/nice-search/

  • The topic ‘WPML compatibility’ is closed to new replies.
Skip to toolbar