WPML
Status
Resolved by author
Resolved in
BetterDocs Pro v3.0.1
Related plugin/theme
BetterDocs
Topic tags
Compatibility

Overview of the issue

If you are using BetterDocs Pro plugin, you will notice that the knowledgebase slug is not properly translated on the category page. When switching between languages, the slug for the Knowledgebase terms do not reflect the change in language, leading to inconsistent URLs on the category page.

Workaround

Please, make sure of having a full backup of your site before proceeding.


  • Open …/wp-content/plugins/betterdocs-pro/includes/Traits/MKB.php file.

  • Look for line 21.

  • Change:
    public function kb_terms( $term, $taxonomy ) {
        $current_term = get_term_by( 'slug', $term->slug, $taxonomy, OBJECT );
        $_term_attr   = get_term_meta( $current_term->term_id, 'doc_category_knowledge_base', true );
    
        if ( ! empty( $_term_attr ) ) {
            $_term_attr = array_values( array_filter($_term_attr, function( $item ){
                return ! empty( $item );
            }) );
        }
    
        return $_term_attr;
    }

  • For:
    public function kb_terms( $term, $taxonomy ) {
        $current_term = get_term_by( 'slug', $term->slug, $taxonomy, OBJECT );
        $_term_attr   = get_term_meta( $current_term->term_id, 'doc_category_knowledge_base', true );
        
        // WPML Workaround for compsupp-6478
        if ( class_exists('Sitepress') ) {
            $_term_attr   = get_term_meta( $term->term_id, 'doc_category_knowledge_base', true );
        }
        
        if ( ! empty( $_term_attr ) ) {
            $_term_attr = array_values( array_filter($_term_attr, function( $item ){
                return ! empty( $item );
            }) );
        }
    
        return $_term_attr;
    }

All known issues →