WordPress.org

Ready to get started?Download WordPress

Forums

Why sanitize_title function output urlencoded lang ja (1 post)

  1. nobita
    Member
    Posted 2 years ago #

    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="http://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="http://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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.