Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Emanuel Poletto

    (@emanuelpoletto)

    Hey there,

    I wrote a solution, if you are interested in…
    I created this function below and replaced all the get_terms with it in the remove-taxonomy-base-slug.php file.
    Refresh the permalinks structure and voilá!

    It doesn’t modify anything else, but only adds support for WPML.
    It would be nice if you consider adding this to the next update of the plugin.
    Maybe you could improve it even more. Anyway, it’s working like a charm here until now.

    function rtbs_get_all_terms( $taxonomy = 'category', $args = array( 'hide_empty' => false ) ) {
    	$terms = get_terms( $taxonomy, $args );
    	if ( function_exists( 'icl_get_languages' ) ) {
    		$languages = icl_get_languages();
    		if ( 1 < count( $languages ) ) {
    			foreach ( $languages as $l ) {
    				$language_code = $l['language_code'];
    				if ( ICL_LANGUAGE_CODE != $language_code ) {
    					foreach ( $terms as $t ) {
    						$id = icl_object_id( $t->term_id, $taxonomy, false, $language_code );
    						if ( null !== $id )
    							$ids[] = $id;
    					}
    				}
    			}
    			if ( is_array( $ids ) && 1 <= count( $ids ) ) {
    				global $wpdb;
    				$ids = implode( ',', $ids );
    				$results = $wpdb->get_results(
    					"
    					SELECT * FROM $wpdb->terms
    					WHERE term_id IN ($ids)
    					"
    				);
    				$terms = array_merge( $terms, $results );
    			}
    		}
    	}
    	return $terms;
    }

    +1 Emanuel Poletto, works perfectly as you said.
    I don’t like modifying other people’s code, so i wonder if this is gonna be included in the next update?
    Until then I have to increase version number so i won’t be updating it accidentally.
    I would like to be notified when this update gets published.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not compatible with WPML?’ is closed to new replies.