Archived post from my old blog (2007–2016), restored from the Wayback Machine. It is published as written at the time, in Italian; tools and versions are likely out of date.
WordPress hierarchical custom taxonomy
Sviluppando un plugin wordpress per un cliente mi sono imbattuto in un problema forse banale, ma molto noioso
L’obiettivo è creare una taxonomy custom per gestire degli item in maniera gerarchica.
Il problema era che seguendo i vari snippet della documentazione ufficiale veniva visualizzato il listing solo se si usava un unico livello nel permalink
Appena si prova a usare livelli annidati viene mostrato un altro tipo di listing (il primo item di quel post-type)
Sostanzialmente il problema sta nel fatto che il settaggio ‘hierarchical’ => true va messo in due posti:
register_taxonomy('myposts','mypost',
array(
'label' => __( 'Una Etichetta' ),
'rewrite' => array( 'slug' => 'myposts' ,'hierarchical'=>true), //true,
'hierarchical'=>true, //
Mezz’ora persa proficuamente investita. Spero possa servire ad altri
← Archive