Make WordPress Core

Ticket #34554: 34554.patch

File 34554.patch, 1.1 KB (added by flixos90, 10 years ago)

Patch which adds the filter

  • src/wp-includes/taxonomy-functions.php

     
    540540        );
    541541        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
    542542
    543         return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
     543        $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
     544
     545        $taxonomy = $tax->name;
     546
     547        $default_labels = clone $labels;
     548
     549        /**
     550         * Filter the labels of a specific taxonomy.
     551         *
     552         * The dynamic portion of the hook name, `$taxonomy`, refers to
     553         * the taxonomy slug.
     554         *
     555         * @since 4.4.0
     556         *
     557         * @see get_taxonomy_labels() for the full list of labels.
     558         *
     559         * @param object $labels Object with labels for the taxonomy as member variables.
     560         */
     561        $labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels );
     562
     563        // Ensure that the filtered labels contain all required default values.
     564        $labels = (object) array_merge( (array) $default_labels, (array) $labels );
     565
     566        return $labels;
    544567}
    545568
    546569/**