I've added an extra field to a taxonomy called "albums" via this function:
add_action( 'albums_edit_form_fields', 'albums_taxonomy_edit_meta_field', 10, 2 );
function save_taxonomy_custom_meta( $term_id ) {
if ( isset( $_POST['term_meta'] ) ) {
$t_id = $term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$cat_keys = array_keys( $_POST['term_meta'] );
foreach ( $cat_keys as $key ) {
if ( isset ( $_POST['term_meta'][$key] ) ) {
$term_meta[$key] = $_POST['term_meta'][$key];
}
}
// Save the option array.
update_option( "taxonomy_$t_id", $term_meta );
}
}
The metadata is saving fine and now I'd like to list or query my taxonomies in a page by displaying next to the taxonomy's name the value of the metadata attached to every taxonomy (in this case, the image). Anybody knows how to do it ?