• I’m using Japanese lang WordPress

    I’m adding this code single.php

    <ul><?php
    $terms = wp_get_post_terms( $post->ID , 'category', array('orderby' => 'ID'));
    foreach($terms as $term){
    	if(cat_is_ancestor_of(19, $term)){
    		$html = '<li><a href="%1$s" title="%2$s">%3$s</a></li>';
    		printf(	$html, esc_url(get_term_link($term, 'category')),sprintf( __( "タイトル %s" ), sanitize_title($term->name,'...')),				esc_html($term->name) );
    	}
    }?></ul>

    Title attribute value is urlencoded when category name Japanese language

    e.g category name ‘日本語’
    result html code like this
    <li><a href="https://www.odekake.biz/wp/?cat=140" title="%e6%97%a5%e6%9c%ac%e8%aa%9e">日本語</a></li></ul>
    I expect the following outputs.
    <li><a href="https://www.odekake.biz/wp/?cat=140" title="日本語">日本語</a></li></ul>

    Is how to use this function wrong?

    or

    title="日本語" attribute value should not use multibite string?

    Please let me know.

  • The topic ‘Why sanitize_title function output urlencoded lang ja’ is closed to new replies.