Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Justin Sternberg

    (@jtsternberg)

    Oh, that’s interesting! Do you think you can provide me the terms/slugs you are using, so I can test it?

    Thread Starter Md Abul Bashar

    (@hmbashar)

    sure, You can test, here is slug

    ????????
    ????????
    ???????
    ?????-??
    ?????
    ???????

    https://prntscr.com/fzw8wf

    And also i have use texonomoy category from default post category

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    @hmbashar can you see if you can determine the current version for that copy of CMB2? I am only seeing 87 lines available in that file in the latest version of the library. So I’m curious if it’s using an older copy.

    Thread Starter Md Abul Bashar

    (@hmbashar)

    I’m using latest version CMB2, I have downloaded 17/07/2017 date, you can check screenshot https://prntscr.com/g04r15

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Based on the original error shown, the cbnews theme has a copy of CMB in it as well, and that’s the source at the moment.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    Michael is right… the theme is the one adding those fields, and it is using the old version of CMB, not CMB2.

    Thread Starter Md Abul Bashar

    (@hmbashar)

    What’s wrong ? I’m using CMB not CMB2 ? i have downloaded from this link https://github.com/CMB2/CMB2, and you can check my folder name, cmb2 https://prntscr.com/g04r15

    Thread Starter Md Abul Bashar

    (@hmbashar)

    If i again download from this link https://github.com/CMB2/CMB2 then you can check this folder name is same https://prntscr.com/g05b8c

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    We realize that you have downloaded CMB2 from Github, but that’s not the source of the issue.

    Look at the path in the error shown in https://prnt.sc/fzeg1y

    \wp-content\themes\cbnews\inc\cmb\includes\types\CMB2_Type_Taxonomy_Base.php
    

    My question is related to what’s the version of the copy of CMB2 in that \wp-content\themes\cbnews\inc\cmb\ directory. It’s not the same copy as your GitHub download.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    Michael is right… the theme is the one adding those fields, and it is using the old version of CMB, not CMB2.

    Sorry, Michael is right, but I was wrong, it’s not using the old version of CMB. But it is loading the CMB2 in your theme. I will still do some testing with those slugs. thank you.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    As a workaround, you can change the default sanitization for that field. It looks like WordPress’ default sanitization method, sanitize_text_field() is the culprit as it converts those slugs to empty strings. If you can modify your field config, doing something like this will fix the issue:

    
    $cmb_options->add_field( array(
    	'name'     => __( 'Test Taxonomy Select', 'cmb2' ),
    	'desc'     => __( 'field description (optional)', 'cmb2' ),
    	'id'       => '_yourprefix_demo_taxonomy_select',
    	'type'     => 'taxonomy_select',
    	'taxonomy' => 'category', // Taxonomy Slug
    	'sanitization_cb' => function( $value ) {
    		return strip_tags( $value );
    	}
    ) );
    
    Thread Starter Md Abul Bashar

    (@hmbashar)

    Thanks for help, If i use this code for taxonomy then work fine without any error

    		'sanitization_cb' => function( $value ) {
    			return strip_tags( $value );
    		} 

    full field codes (for group field)

    
    	$morenews->add_group_field( $news_style_three, array(
    		'name'       => esc_html__( 'Right Category', 'cmb2' ),
    		'id'         => 'three-right-news-cat-name',
    		'type'       => 'taxonomy_select',
    		'taxonomy'	 => 'category',
    		'sanitization_cb' => function( $value ) {
    			return strip_tags( $value );
    		}
    		// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
    	) );
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds good, thanks for the update and what you found to work for sure for you.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘I can’t select category if slug another language.’ is closed to new replies.