Ich muss alle Tagnamen im Frontend anzeigen, ich habe versucht
$terms=get_terms('product_tag');
Aber es gibt null zurück.
Kann mir bitte jemand helfen Wie bekomme ich es?
Sie müssen das Array durchlaufen und ein separates Array zum Einchecken erstellen, da get_terms das Objekt in Array zurückgibt.
$terms = get_terms( 'product_tag' ); $term_array = array(); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { $term_array[] = $term->name; } }
Lösung von stackoverflow click für weitere Details