タクソノミー・ターム関連

カスタム投稿 タクソノミー ターム関連

Deprecated: Function create_function() is deprecated in /home/warai-plus/www/bugpixel.net/wp/wp-includes/pomo/translations.php on line 202

Notice: A non well formed numeric value encountered in /home/warai-plus/www/bugpixel.net/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/warai-plus/www/bugpixel.net/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Deprecated: Function create_function() is deprecated in /home/warai-plus/www/bugpixel.net/wp/wp-includes/pomo/translations.php on line 202

Notice: A non well formed numeric value encountered in /home/warai-plus/www/bugpixel.net/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/warai-plus/www/bugpixel.net/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Deprecated: Function create_function() is deprecated in /home/warai-plus/www/bugpixel.net/wp/wp-includes/pomo/translations.php on line 202

Notice: A non well formed numeric value encountered in /home/warai-plus/www/bugpixel.net/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/warai-plus/www/bugpixel.net/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

// カスタム分類名
$taxonomy = ‘activity-cat';

// カスタム分類のタームのリストを取得
$terms = get_terms( $taxonomy , $args );

// 子タームのIDのリストを取得
$term_children = get_term_children( $term->term_id, $taxonomy );

// タームのURL
esc_url( $term_link )

// ターム名
$term->name

// 子タームの場合の条件分岐
if( $term->parent != 0 ) {
echo ‘子の場合';
} else {
echo ‘親の場合';
}

——————————

ターム情報の出力

取得した情報を出力します。取り出せる項目はこちら

term_id
name
slug
term_group
term_taxonomy_id
taxonomy
description
parent
count

ad