S
S
Socrates2018-02-26 15:55:01
WordPress
Socrates, 2018-02-26 15:55:01

Display custom taxonomy values?

Registered, CPT and custom-taxonomy, how do I display the names that I added to the taxonomy.
I try like this

$terms = get_terms([
    'taxonomy' => "taxbeton",
    'hide_empty' => false,
]);

print_r($terms);

I get an array:
Array ( [0] => WP_Term Object ( [term_id] => 3 [name] => Бетон гидротехнический [slug] =>%d0%b1%d0%b5%d1%82%d0%be%d0%bd-%d0%b3%d0%b8%d0%b4%d1%80%d0%be%d1%82%d0%b5%d1%85%d0%bd%d0%b8%d1%87%d0%b5%d1%81%d0%ba%d0%b8%d0%b9 [term_group] => 0 [term_taxonomy_id] => 3 [taxonomy] => taxbeton [description] => [parent] => 0 [count] => 0 [filter] => raw ) [1] => WP_Term Object ( [term_id] => 2 [name] => Бетон товарный [slug] => %d0%b1%d0%b5%d1%82%d0%be%d0%bd-%d1%82%d0%be%d0%b2%d0%b0%d1%80%d0%bd%d1%8b%d0%b9 [term_group] => 0 [term_taxonomy_id] => 2 [taxonomy] => taxbeton [description] => [parent] => 0 [count] => 0 [filter] => raw ) [2] => WP_Term Object ( [term_id] => 4 [name] => Керамзитобетон [slug] => %d0%ba%d0%b5%d1%80%d0%b0%d0%bc%d0%b7%d0%b8%d1%82%d0%be%d0%b1%d0%b5%d1%82%d0%be%d0%bd [term_group] => 0 [term_taxonomy_id] => 4 [taxonomy] => taxbeton [description] => [parent] => 0 [count] => 0 [filter] => raw ))

how can i get the name here ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Socrates, 2018-02-26
@Karmov69

print_r($terms['0']->name);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question