wpseek.com
A WordPress-centric search engine for devs and theme authors
get_taxonomy_labels › WordPress Function
Since3.0.0
Deprecatedn/a
› get_taxonomy_labels ( $tax )
Parameters: |
|
Returns: |
|
Defined at: |
|
Codex: | |
Change Log: |
|
Builds an object with all taxonomy labels out of a taxonomy object.
Related Functions: get_taxonomy_template, get_taxonomies, get_taxonomy, get_the_taxonomies, get_post_taxonomies
Source
function get_taxonomy_labels( $tax ) { $tax->labels = (array) $tax->labels; if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) ) { $tax->labels['separate_items_with_commas'] = $tax->helps; } if ( isset( $tax->no_tagcloud ) && empty( $tax->labels['not_found'] ) ) { $tax->labels['not_found'] = $tax->no_tagcloud; } $nohier_vs_hier_defaults = WP_Taxonomy::get_default_labels(); $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults ); if ( ! isset( $tax->labels->template_name ) && isset( $labels->singular_name ) ) { /* translators: %s: Taxonomy name. */ $labels->template_name = sprintf( _x( '%s Archives', 'taxonomy template name' ), $labels->singular_name ); } $taxonomy = $tax->name; $default_labels = clone $labels; /** * Filters the labels of a specific taxonomy. * * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. * * Possible hook names include: * * - `taxonomy_labels_category` * - `taxonomy_labels_post_tag` * * @since 4.4.0 * * @see get_taxonomy_labels() for the full list of taxonomy labels. * * @param object $labels Object with labels for the taxonomy as member variables. */ $labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels ); // Ensure that the filtered labels contain all required default values. $labels = (object) array_merge( (array) $default_labels, (array) $labels ); return $labels; }